Repository navigation
ritmo-devtools layout: audit a game's page for broken layout at each screen size - #235
Open
SandroMaglione wants to merge 6 commits into
Open
SandroMaglione wants to merge 6 commits into
SandroMaglione wants to merge 6 commits into
Conversation
The layout audit reads the same route file as the keyboard walk and reaches screens the same way, so the route parser and the code that opens a screen move out of keyboardWalk.ts. The route gains a type step (to fill a name field on the way to a screen) and the layout audit's fields (viewports, minTarget, allow), which the keyboard walk ignores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HendNejwwEtfv3nfMtbBwn
The Touch buttons are drawn on the canvas, so a page audit cannot see them. While attached, the target carries a function returning the layout at its current size (under a Symbol.for key), and dispose() removes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HendNejwwEtfv3nfMtbBwn
Opens each screen of the route in Chromium at each viewport (phones held both ways, with an iPhone's notch and home bar, and a desktop by default) and reports what is broken in the layout the player sees. Errors fail the run: overlap, cut-text, off-screen, safe-area, small-target, layout-shift, never-settled. Warnings never fail, because a game may mean them: truncated-text (an ellipsis or clamp), scroll-edge, and what breaks only with every text 40% longer. A route's allow leaves out what the game means. The rules come from a prototype run on spirit-call: a control that draws nothing (a touch area over the stage) is not an overlap, something behind a scrim is not under the scrim's text, a box that spans the screen cuts at the screen's edge, items in a scrolling area are judged by it, and a tap area is measured by hit tests so a ::after extension counts. Touch buttons are read from the target Touch.actions marks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HendNejwwEtfv3nfMtbBwn
…vered layouts; docs and changesets A Touch layout under a menu takes no tap, so its buttons are not in play and are left out rather than reported as covered. Route clicks look in an open menu first, as a player would. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HendNejwwEtfv3nfMtbBwn
The website's town demo starts from a "Play" button that covers the whole page: it reached into the notch and lay under the other controls, which is what it is for. A control over the whole safe area is not judged by safe-area, and one under the whole of another is its backdrop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HendNejwwEtfv3nfMtbBwn
…rules Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HendNejwwEtfv3nfMtbBwn
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Sandro · project thread
What
ritmo-devtools layoutis a sibling ofritmo-devtools keyboard. It uses the same route file and the same Chromium. It opens each screen at several screen sizes and reports what is broken in the layout the player sees. It measures the laid-out page (text line rects, hit tests, CDP safe-area insets, Chromium layout-shift entries), not pictures.Errors (exit 1):
overlapcut-textoff-screensafe-areasmall-targetlayout-shiftnever-settledWarnings (never fail):
truncated-text(an ellipsis or line clamp says the cut is meant)scroll-edge(a control half hidden at a scroller's edge)A route can
allowa finding by check and selector, on the route or on one screen. The summary counts what it allowed.--screenshots <dir>saves each screen with numbered boxes, red for errors and amber for warnings.--jsonprints the report.Default viewports (a route can list its own):
Other changes:
Touch.actions(ritmo-browser) now leaves a reader on its target, underSymbol.for("@typeonce/ritmo-browser/Touch.layout"). The audit uses it to check canvas-drawn touch buttons: overlap with the page, between buttons, safe area, size.internal/route.ts,internal/pageOpen.ts).typestep, and a click looks in an open menu first.Rules added to avoid false alarms
These came from the Phase 1 prototype and from the runs below:
innerWidth, which widens on mobile when content overflows.Run on reference games
spirit-call, 12 screens × 3 landscape viewports,
minTarget: 42: 55 errors and 31 warnings, all real by measurement.The prototype's false alarms no longer appear: the invisible rotate-stage control, the control under the pause scrim, and the scaled 44-unit targets.
website town demo (
/play/town/): 2 errors, both real.One false alarm on the full-page "Play" start button is fixed by the backdrop rules above, with a fixture.
Verify
pnpm typecheck,pnpm lint,pnpm test-types,pnpm check-examples, andpnpm test(172 files, 2015 tests) all pass.pnpm pack:checkpasses.pnpm --dir website buildpasses.Generated by Claude Code