Skip to content

fix: raise secondary text contrast, enlarge small targets, and honor reduced motion (#7) - #18

Merged
GeoBradDev merged 6 commits into
mainfrom
issue-7-contrast-and-target-size
Nov 8, 2026
Merged

GeoBradDev merged 6 commits into
mainfrom
issue-7-contrast-and-target-size

Conversation

@GeoBradDev

Copy link
Copy Markdown
Owner

Fixes the WCAG 2.2 AA contrast, target size, and motion problems from #7. The change is CSS only (src/index.css), with two new token-level tests. The dark HUD look is kept.

  • Contrast (1.4.3): --text-dim goes from #2d5a42 to #5aa37f. That is the smallest step from the old value toward --text-primary (same hue) that clears 4.5:1 on every background where dim text sits. It covers the GPU panel keys, the "SYS" status, the "ACTIVE n/n" footer, OFF labels, popup property keys, and the Close glyph. .gpu-info-sep loses its opacity: 0.5, since at half opacity it could not pass with any dim value.
  • Target size (2.5.8): the popup Close button goes from 20x20 to 24x24. The stress slider input becomes a 24px tall hit area with a 4px track (was 2px). The thumb box is 24x24 (was 10x10). Its visible part is a 12px blue square with a soft glow, drawn by backgrounds so it still looks small.
  • Reduced motion: a final @media (prefers-reduced-motion: reduce) block sets animation: none !important; transition: none !important on everything. That stops the indicator pulse, the popup slide-up, the bottom sheet fade-in from Layout breaks on mobile: header text overlaps and panels overflow at 375px #5, and the hover transitions. !important is needed to win over the narrow block's later animation-name: fade-in.

Contrast, old and new. Backgrounds are modeled as rendered. Panels over the map use --bg-panel composited over white, the worst case.

Pair Before After
dim on panel over map (GPU keys, footer, prop keys, separators) 2.20:1 5.79:1
dim on header (--bg-panel over --bg-void) 2.49:1 6.55:1
dim on --bg-deep (Close glyph, sticky popup header) 2.48:1 6.53:1
OFF label on a hovered layer row (--accent-glow over panel over white) 1.76:1 4.62:1
.gpu-info-sep (was at 0.5 opacity) 1.43:1 5.79:1
lowest other text color: --red on panel over white 4.82:1 4.82:1 (unchanged)

Not done: the issue's "consider a 12px minimum" for body text. Raising the 8 to 11px text (badge, status, GPU panel, panel labels) would undo the 641px header spacing and the GPU panel widths that #5 tuned. That is left as a follow-up.

Plan

docs/plans/2026-11-07-issue-7-contrast-and-target-size.md, committed in 2a91fab. Revisions:

  • 307813e: --text-dim moved from the first value, #4f9170, to #5aa37f. Review found that a hovered OFF row puts the dim text on --accent-glow (3.72:1 over a white map). A token step was chosen over a new hover color: rule, which keeps the change to one token. A criterion 1 background model for the hovered row was added.
  • 0a09b38: records a side effect of the lighter token on two non-text uses (see Review findings).

Frozen tests: src/styles.test.js (red in c295aa5) and src/styles.states.test.js (red in a1428ff).

Test evidence

Gate on 307813e (0a09b38 changes plan text only):

  • npm ci: 0 vulnerabilities.
  • npm run lint: clean.
  • npm test: 17 files, 167 tests passed.
  • npm run build: built. The usual large-chunk warning is printed.
  • npm audit --omit=dev --audit-level=high: 0 vulnerabilities.

New unit tests:

  • src/styles.test.js parses the :root tokens out of src/index.css and computes WCAG contrast for every text pair, and for the slider track, thumb, and off dot at 3:1. It fails if any color: rule in index.css is missing from its pair table. It also asserts the 24px sizes and the reduced-motion block.
  • src/styles.states.test.js models the hovered layer row. It fails if any :hover, :focus, :active, or :has( rule sets a background without a modeled state pair.

Live drive and independent verification (Playwright, headless Chromium, against vite build + vite preview):

  • Target sizes:
    • Close: 24x24, and topmost at its center at 375, 768, and 1440.
    • Slider: 98x24, or 122x24 at 375. The full 24px height is clickable: clicks 2px inside the top and the bottom edges both set the value. Keyboard arrows, Home, End, a click on the track, and a drag on the thumb all work.
    • Thumb: the visible square is 12x12 and centered on the track.
    • Layer rows: 194x32, or 218x32 at 375.
    • "Sensor layers" toggle: 218x32. MapLibre attribution button: 24x24.
  • Contrast in the browser:
    • Every visible text node was composited over its real ancestor backgrounds, with white under the floating panels: 49 nodes at 1440, 36 at 768, and 28 at 375. The minimum is 5.79:1 at rest and 4.62:1 for the hovered OFF row.
    • The MapLibre attribution renders compact: 21:1 text, 10.4:1 links.
  • Reduced motion:
    • With Playwright reducedMotion: 'reduce', at 1440 and 375, .panel-indicator, .feature-popup, .layer-row, .layer-dot, .layer-label, and .popup-close all compute animation-name: none and transition: none 0s. document.getAnimations() is empty, and the indicator stays at opacity 1.
    • With no preference, blink-pulse (2.4s), slide-up (1440), fade-in (375), and the 0.15s transitions all still run.
  • Layout breaks on mobile: header text overlaps and panels overflow at 375px #5 layout re-check, with the popup open and the slider at 5,000,000:
375x812 768x1024 1440x900
Header overlaps none none none
Layer panel (expanded) 143,61 to 363,258 556,62 to 752,255 1228,62 to 1424,255
GPU panel hidden while popup open (by design) 330,939 to 758,984 674,830 to 1430,860
Popup 0,547 to 375,812 20,709 to 308,1000 20,585 to 308,876
All panels inside viewport yes yes yes
.stress-count "5.0M PTS" fits 64 of 64px 64 of 64px 64 of 64px
Run Score color-contrast target-size
Before (0131dc1), desktop 1 pass, 0 items pass, 0 items
Before (0131dc1), mobile 1 pass, 0 items pass, 0 items
After, desktop 1 pass, 0 items pass, 0 items
After, mobile 1 pass, 0 items pass, 0 items

Lighthouse passed before the fix too. axe cannot determine backgrounds over the map canvas and gradients, so it reports those nodes as "incomplete", and Lighthouse does not fail on "incomplete". After the fix, axe in the page reported 0 color-contrast violations and 29 to 35 incomplete. That is why the token tests and the computed checks above are the real proof.

Not verified in a browser: Firefox ::-moz-range-* rules (only Chromium was driven; the unit test asserts the sizes). The heatmap layer row did not render in headless, which has no WebGPU.

Review findings

  • Fixed, raised by both a Claude finder and a Fable finder: a hovered OFF layer row was 3.72:1 with the first --text-dim value. Fixed in 307813e, with the new frozen test a1428ff.
  • Dismissed, Claude finder: the claim that MapLibre's non-compact attribution (50% white, 75% black links, about 4.1 to 4.4:1) fails. MapLibre 6 defaults to compact: true (node_modules/maplibre-gl/dist/maplibre-gl-dev.mjs, defaultAttributionControlOptions), so only the compact form renders. In the browser it measured opaque white with 21:1 text and 10.4:1 links, at 1440 and 375, and minimized it is a 24x24 button.
  • Accepted and noted in the plan, Claude delta finder: the lighter token narrows two luminance cues that now rest on hue. The sparkline history bars against the latest blue bar drop from 3.09:1 to 1.17:1. An off layer dot against the on colors drops too: heatmap 1.08:1, airports 1.58:1, ports 2.25:1. Neither fails WCAG: the ON/OFF text states the layer state, and the frame time is printed as text.
  • Nits left as is:
    • The slider focus ring CSS is unchanged, but it now wraps the 24px input, so it draws about 36px tall instead of about 14px.
    • rule() in src/styles.test.js merges same-selector rules across media blocks. Nothing triggers this today.
    • The off-dot token is hardcoded in the test.
    • The two test files duplicate their small parsing and contrast helpers.
    • The CRT scanline overlay tints every fourth pixel row slightly. On those rows the hovered OFF text measures 4.53:1, still passing.
  • Verifier (fresh context): no findings.

Docs reconciled

  • README.md: no change needed, because it says nothing about colors, control sizes, or motion that this change makes false.
  • CLAUDE.md: no change needed, because no mistake repeated across runs. The new style tests explain themselves when they fail.
  • ADR: none.

Closes #7

🤖 Generated with Claude Code

https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf

GeoBradDev and others added 6 commits November 7, 2026 18:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
… honor reduced motion (#7)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf
@GeoBradDev
GeoBradDev merged commit 050e49b into main Nov 8, 2026
1 check passed
@GeoBradDev
GeoBradDev deleted the issue-7-contrast-and-target-size branch November 8, 2026 01:38
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.

Secondary text fails WCAG contrast (2.48:1) and controls are below 24px target size

1 participant