Skip to content

fix: make the layout work on mobile and small screens (#5) - #17

Merged
GeoBradDev merged 14 commits into
mainfrom
issue-5-layout-breaks-on-mobile
Nov 8, 2026
Merged

GeoBradDev merged 14 commits into
mainfrom
issue-5-layout-breaks-on-mobile

Conversation

@GeoBradDev

Copy link
Copy Markdown
Owner

Makes the app usable on phones and small windows. Before this change there were no media queries: at 375px the header text overlapped, the GPU panel ran off the left edge, and the layer panel covered more than half the map.

  • Small screens (NARROW_QUERY = (max-width: 640px), (max-width: 1024px) and (max-height: 500px), shared by src/hooks/useMediaQuery.js and the CSS):
    • The layer panel starts collapsed behind a "Sensor layers" button: a native <button type="button"> with aria-expanded, aria-controls pointing at the panel body, a :focus-visible outline, and a 218x32 target. When collapsed, the body uses the hidden attribute, so its controls leave the Tab order and the accessibility tree. On wide screens no button is rendered and the panel works as before.
    • The header wraps to two rows: the title on top, the badge and clock below. The coordinates, status, and separators are hidden.
    • The feature popup becomes a full-width bottom sheet capped at 50% of the map area. It fades in, and the GPU panel is hidden while it is open. The layer panel's height is capped so it never runs under the sheet or the GPU panel.
  • 1024px and below: the coordinates are hidden, the title shrinks, and the GPU panel shows only RENDER, PTS, and FRAME, using a column gap instead of | separators so a wrapped row never ends in one.
  • All widths:
    • The GPU panel gets max-width: calc(100vw - 32px) and wraps.
    • The popup gets max-height: calc(100% - 48px) with a sticky header, so Close stays visible while a long feature scrolls.
    • .app-body gets overflow: clip (inside @supports, with hidden as the fallback), so focusing the popup dialog can never scroll the map area.
  • Stress count clipping (from the issue comment): .stress-slider gets min-width: 0, and .stress-count gets flex-shrink: 0; min-width: 64px. "5.0M PTS" now fits at every width.
  • The keyboard and screen reader work from Layer toggles, stress slider, and feature popup are not keyboard or screen reader accessible #4 (PR fix: make layer toggles, stress slider, and feature popup keyboard and screen reader accessible (#4) #16) is kept: visually hidden checkboxes named " layer", focus rings, slider name and value text, and popup dialog focus management.

Plan

docs/plans/2026-11-07-issue-5-layout-breaks-on-mobile.md, committed at 6bcb271 before any code. It was revised in later commits as review found gaps:

  • Review round 1: landscape phones (criteria 10 to 12).
  • Delta review: short desktop windows stay wide, plus height caps (criteria 13 and 14).
  • Verifier round 1: popup open no longer scrolls the map area (criterion 15).
  • Verifier round 2 and delta reviews: production CSS output (criterion 16). A build.cssTarget was tried in c778581 and removed in bf9f7d8: the JS bundle already needs Vite 8's default targets (chrome111, safari16.4), and every one of those parses range media syntax.

Test evidence

Gate on b584144 (the later commit only changes the plan). npm run build was rerun before the verifier drives.

npm ci                                   added 330 packages ... found 0 vulnerabilities
npm run lint                             eslint . (no findings)
npm test                                 Test Files 15 passed (15) / Tests 119 passed (119)
npm run build                            built; only the existing "chunks larger than 500 kB" warning
npm audit --omit=dev --audit-level=high  found 0 vulnerabilities

New tests:

  • src/hooks/useMediaQuery.test.js: returns false without matchMedia, follows change events, removes its listener, checks the query string.
  • src/components/LayerPanel.test.jsx (narrow screens): the toggle's name, aria-expanded and aria-controls; the body is hidden and its controls are out of the accessibility tree; click, Enter and Space toggle it; the toggle comes first in Tab order; no toggle on wide screens.
  • src/components/GPUInfoPanel.test.jsx: which items carry the secondary class.

Live drive: headless Chrome through Playwright on the production preview build, plus the dev server to open popups from the store, and real clicks on port points. Headless Chrome has no WebGPU, so it renders 2 layer rows and "WebGL Fallback". Final independent verifier on b584144:

375x812 (DPR 2, touch) 768x1024 1440x900
Header elements shown badge, title, clock (2 rows, 49px) badge, sep, status, title, clock (46px) all 7 (46px)
Header pairwise overlaps 0 0 0
Title scrollWidth/clientWidth 178/178 208/208 313/313
Layer panel collapsed [143,61,363,95], expanded [143,61,363,245] [556,62,752,242] [1228,62,1424,242]
GPU panel [22,727,365,772], RENDER PTS FRAME [330,939,758,984], RENDER PTS FRAME [664,830,1430,860], all 6
All panels inside viewport yes yes yes
Map visible fraction 0.864 (collapsed) 0.886 0.904
"5.0M PTS" fit (scrollWidth/clientWidth) 64/64, right edge 350 vs panel 363 64/64 64/64, right edge 1411 vs 1424
Popup sheet [0,430.5,375,812], GPU panel hidden [20,518,308,1000], 0 overlap with GPU panel [20,394,308,876], 0 overlap
.app-body scrollTop over 3 opens, sampled every frame 0 0 0
  • 375x812 controls: the toggle, both rows, the slider and popup Close are each topmost at their centers, including after scrolling the sheet to the bottom.
  • Toggle: aria-expanded goes false, then true. Collapsed, Tab skips the panel body. Keyboard focus shows a 2px rgb(0,255,136) outline at -2px.
  • Other sizes, also measured:
    • 740x360, 640x360 and 568x320 (landscape phones): narrow layout, 0 overlaps between panels, map fraction 0.731 to 0.788.
    • 1440x480 and 1100x450: stay wide, with no toggle and a single-row header.
    • 641x900 and 700x900: 0 header overlaps.
  • Neighboring flows:
    • Layer toggles change the PTS count. The slider reaches 5,073,769 and Home resets it to 73,769.
    • Escape and Close close the popup, and focus returns to the element that had it before.

Review findings

Each finding was checked against the code before it was fixed or dismissed.

Fixed:

  • Landscape phones (740x360) got the wide layout, and the GPU panel overlapped the layer panel. Claude finder; the Fable finder noted the same. The narrow query gained a height clause.
  • Wide, short desktop windows (1440x480) got the phone layout after that change. Claude delta finder. The height clause is now limited to widths of 1024px or less.
  • 568x320: the expanded layer panel covered the GPU panel. Claude delta finder. The narrow panel's height is now always capped.
  • Desktop popup had no height cap, so on short windows it ran past the top of the viewport. Found by the coordinator.
  • A | separator ended a wrapped GPU panel row. Claude finder and Fable finder notes.
  • The bottom-sheet Close button scrolled out of view. Fable finder. The popup header is now sticky.
  • The header overlapped at 641px. Raised by both finders as a risk, then measured. Spacing was tightened.
  • The layout jumped 9px each time a popup opened on narrow screens. The slide-up overflowed .app-body, and the dialog's focus() scrolled it. Verifier 1. The sheet now fades in, and .app-body uses overflow: clip.
  • The production CSS minifier merged away the overflow: hidden fallback. Claude delta finder. clip now sits inside @supports.
  • The minifier emits range media syntax. Verifier 2. First handled with build.cssTarget. A delta finder then showed it bought nothing, since the JS bundle's targets already parse range syntax, so it was removed.
  • README and plan wording. Doc finders: the GPU panel stats at 1024px or less, COMPUTE -- only above 1024px, a new "Small screens" bullet, the useMediaQuery entry in the project layout, and plan criterion references and counts.

Dismissed, with reasons:

  • Focus falls to body when the window crosses the breakpoint with focus inside the panel. Rare, and the plan chose not to auto-collapse.
  • getSnapshot does not cache its MediaQueryList. A matchMedia call is cheap.
  • Safari 13 and older lack MediaQueryList.addEventListener. Below the build's targets.
  • The .app-title scrollWidth check cannot fail. The pairwise overlap check covers the title.
  • Windows over 1024px wide and under about 340px tall: the layer panel overlaps the GPU panel. main does the same, and the plan keeps the desktop layout.

Nits left as they are:

  • The gpu-info-secondary class on the separators is now redundant.
  • The opaque sticky popup header is slightly darker than the sheet.
  • The layer panel's top accent line scrolls away when the capped panel scrolls.
  • The sheet's focus outline is clipped at the viewport edges.

Process notes:

  • The doc review stopped after three rounds. The last one raised only wording nits, which were applied.
  • The last wording commits (b584144 and 54ba93b) change only a CSS comment and plan text, and the built CSS hash did not change.
  • Verifier 3 reported no behavior findings. Its one plan-text gap, a rule count, is fixed in 54ba93b.

Out of scope, for issue #7: the 20x20 popup Close button, the 2px slider track, and contrast.

Docs reconciled

  • README.md:
    • The GPU info panel bullet now notes the reduced stats at 1024px or less, and that the panel is hidden while a popup is open on small screens.
    • New "Small screens" feature bullet.
    • The WebGPU note now says COMPUTE shows -- only above 1024px.
    • useMediaQuery added to the project layout.
  • CLAUDE.md: no change needed. Its gate, rules, and git exception are unaffected.
  • ADR: none.
  • No CLAUDE.md, .claude/**, or REVIEW.md changes, so there are no eval-suite implications.

Closes #5

🤖 Generated with Claude Code

https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf

GeoBradDev and others added 14 commits November 7, 2026 16:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
#5)

Fix the stress count clipping at 5,000,000 points, wrap and trim the
header and GPU panel at 1024px and 640px, turn the popup into a bottom
sheet on phones, and keep the GPU panel clear of the popup at tablet
width. Plan updated with the two live drive tunings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
Treat short landscape screens as narrow, drop GPU panel separators for a
column gap so wrapped rows never end in one, keep the bottom sheet header
sticky so Close stays in view, cap the expanded layer panel above an open
sheet, and tighten header spacing so it clears at 641px. Plan updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
…#5)

Limit the short-height narrow condition to 1024px wide so 1440x480 and
1100x450 keep the desktop layout, cap the narrow layer panel above the
GPU panel, and cap the desktop popup to the map area with a sticky
header at every width. Plan updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
…#5)

Make .app-body overflow: clip so the dialog focus cannot scroll it, and
fade the bottom sheet in instead of sliding it up past the map area.
Plan updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
… CSS (#5)

Set build.cssTarget to older browsers so the minifier stops emitting
range media syntax that Safari before 16.4 cannot parse, and move
overflow: clip into @supports so the hidden fallback survives
minification. Plan updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
…#5)

The entry bundle uses class static blocks, so browsers that cannot parse
range media syntax never run the app. Restore vite.config.js and keep
overflow: clip in @supports so the hidden fallback survives minification.
Plan updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
@GeoBradDev
GeoBradDev merged commit 0131dc1 into main Nov 8, 2026
1 check passed
@GeoBradDev
GeoBradDev deleted the issue-5-layout-breaks-on-mobile branch November 8, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Layout breaks on mobile: header text overlaps and panels overflow at 375px

1 participant