Repository navigation
fix(ui): announce form errors, manage focus, respect reduced motion - #126
Merged
Merged
Conversation
MotionConfig covers every motion.* in the tree (the peek strips, the drawer cross-fade); the vaul drawers animate in CSS and so need a CSS switch of their own. Both are driven by a LIVE read of the preference — MotionConfig's own `reducedMotion="user"` reads matchMedia once at mount, which would let a viewer who flips the setting mid-session keep the motion, and disagree with the media query the drawers are on. Refs #102 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A failed submit was silent. Field errors carried the aria-describedby id but no live semantics, so nothing was announced for any field a reader was not already standing on (WCAG 4.1.3 / 3.3.1). FormField's error span is now role="alert" by default. It cannot chatter per keystroke, because it is mounted only while an error is set and the registration form validates on submit; a live region speaks on mutation, so re-validating an unchanged message says nothing. ReportIssueForm opts out — it validates on every keystroke and gates Send on validity, so it has no failed submit to announce, only interruptions to offer. Focus already moved for the two register()ed inputs (react-hook-form's default shouldFocusError). The gap was the starting-date RadioGroup: a Controller field RHF was never handed a ref for, so a submit with no date chosen moved nothing and said nothing. RadioGroup now forwards a ref to its first radio. Refs #102 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…name Four findings from the readiness review, all in the same register — a control that works but cannot be seen or told apart. Peek strips: each one was named "Back", so a three-deep stack offered three identically-named buttons going to three different places. They now name their destination from the caches the app has already filled (cache-only, like DrawerChrome — a miss costs the name, not the strip), and draw the app's focus ring, which they had none of. Chip's close button showed only an opacity lift on focus — which is also what hover does, so on a chip under the pointer it showed nothing. Spinner's screen-reader text was the app's one hard-coded English string. It is a prop now, defaulting to English: the atom cannot call t() because it renders in Suspense fallbacks that run before the bundles load, where t() returns the raw key. The contact popover portals out of the tree with no focus management, so pressing Contact announced a dialog and then tabbed past it. Also localizes Mapbox's GeolocateControl, the last English-only label. Construction-only — react-map-gl does not reconcile `locale` — which is the same limitation the `language` prop beside it already carries. Refs #102 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The peek-strip names were reading their two caches through
`useQuery({ enabled: false })`, copying DrawerChrome. That is right for
DrawerChrome, which mounts only while a view is loading or has thrown,
and wrong here: DrawerStack is mounted for the whole session, and React
Query counts gcTime from the last observer unmounting — so the region
tree and one titles Map per language visited would never be collected.
Reads them with getQueryData instead, which keeps the cache-only
contract and drops the subscription.
Also: a Map rather than a linear scan of every region in the world, per
strip, per render; `t` off useLocale at three call sites (it already
holds one for the default namespace and returns it to avoid exactly this
duplicate subscription); and two comments that described APIs this repo
does not use.
Refs #102
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying sahajatlas with
|
| Latest commit: |
badd715
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fa521e6d.sahajatlas.pages.dev |
| Branch Preview URL: | https://fix-a11y-forms-motion.sahajatlas.pages.dev |
Contributor
Author
CI:
|
| Severity | Package | Advisory |
|---|---|---|
| high | image-size |
GHSA-w3rx-r6r6-pgpr, GHSA-5p2g-fcmc-qvqq |
| high | nanoid |
GHSA-28wg-ghj8-5hjv, GHSA-2v37-7h3g-55p8 |
Not caused by this PR:
- the diff contains no
package.jsonand nopnpm-lock.yamlchange (git diff --name-only origin/main...HEAD); - both are transitive dev-graph packages nothing here imports;
- PR perf(list): bound the results list by DOM budget, not virtualization #125 fails the same check identically, so it is a repo-wide condition that appeared when the advisories were published, not a property of either branch.
Deliberately not fixed here. The check's own message offers two routes — bump the dependency, or add the ids to scripts/audit-baseline.json "with the ticket that owns it". Bumping touches the lockfile, which would conflict with every sibling branch in flight this wave; baselining is a security-debt decision that should be recorded against a ticket that owns it, not slipped into an accessibility PR. It wants its own ticket.
This was referenced Aug 7, 2026
Ardnived
added a commit
that referenced
this pull request
Aug 8, 2026
Four high advisories published 2026-08-07 against the existing lockfile (image-size x2, nanoid x2) turned the audit gate red on every open PR, none of which touch either package. Both are verified absent from the shipped bundle by build + grep — payload is types-only so image-size never ships, postcss is build-time, and the one 'nanoid' string in dist/ is zod's .nanoid() validator name. image-size has no published fix; nanoid's is held back by postcss's own pin and arrives free under #101. Baselined against #101 with per-entry reasoning. Unblocks #123, #125, #126, #127.
Deploying sahajatlas-design with
|
| Latest commit: |
badd715
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a1a90f6a.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://fix-a11y-forms-motion.sahajatlas-design.pages.dev |
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.
Summary
Three accessibility groups from
.claude/reports/RELEASE_READINESS.md§5.FormField's error span isrole="alert", which is what tells a viewer about the invalid fields they are not focused on, and focus now reaches the first invalid field in every case.prefers-reduced-motionis honoured, through one seam per animation technology rather than one per component.Changes worth explaining
The ticket was wrong about two things, both verified rather than assumed.
Focus already worked — for two of the three fields. react-hook-form's
shouldFocusErrordefaults to true and was already focusing theregister()ed inputs. The real gap was the starting-date field: aControllerwrappingRadioGroup, which is notforwardRefand so swallowedfield.ref. RHF storesundefinedfor such a field and skips it in silence, so a submit with no date chosen moved nothing and said nothing. Fixed at the atom; nosetFocuscall was added, because the library's own default now reaches every field and a second implementation could only drift.The map camera needed nothing. mapbox-gl already handles reduced motion in the same three calls
use-mapbox.tsmakes —flyToshort-circuits tojumpTo,easeTozeroes its duration,fitBoundsreaches one of them — gated onrespectPrefersReducedMotion(defaults on) and on a live.matchesread.flyTo's branch preservespadding/retainPaddingthrough the jump, andfitBoundsOptionscontributes onlymaxZoom+padding, so nothing of ours is lost. A hand-rolled branch would have been dead code that drifts from the one that actually runs. The hook gained a comment recording the verification and the two ways to break it (respectPrefersReducedMotion: false, oressential: trueon a camera call).Announcement had to be opt-outable.
ReportIssueFormusesmode: 'onChange', so an unconditional alert would fire on the first character of an email address. It also gates Send onisValid, so it has no failed submit to announce. Both its fields passannounceError={false}. The default is on, so a future form's failure mode is over-announcement (audible, fixable) rather than silence (invisible).Reduced motion is three seams, not three components — framer's
MotionConfig, a CSS media block for vaul (which animates in CSS), and mapbox-gl's own check.MotionConfigis driven byusePrefersReducedMotion()rather than framer'sreducedMotion="user", which reads matchMedia once at mount;"user"would have disagreed with the other two seams for the rest of any session in which the viewer flipped the setting. The hook's own doc comment had flagged this and left the decision to whoever landed it.Verification
assert:css✓ ·pnpm size✓ ·ladle:build✓Review passes: 3 of 5 complete.
/simplify's four cleanup agents (reuse, simplification, efficiency, altitude) all completed and were triaged. The/code-reviewand/security-reviewpasses did not run — security was correctly skipped (no risky paths: noconfig/api,Widget.tsx, HTML sinks, deps or env in the diff), but/code-reviewnever ran because the session was interrupted twice. Worth a reviewer's attention accordingly.The efficiency pass caught a regression this branch introduced: the strip-name lookups were reading their caches through
useQuery({ enabled: false }), copied fromDrawerChrome. That is right there (it mounts only during loading/error) and wrong inDrawerStack, which is mounted for the whole session — React Query countsgcTimefrom the last observer unmounting, so the region tree and one titles Map per language would never be collected. Now read viagetQueryData.Manual accessibility checks for a browser
Not run here — this wave's browser was owned by a sibling ticket. In rough priority:
prefers-reduced-motion: reduceset at the OS level: drawers should appear/dismiss instantly (no slide), peek strips should not travel, and map navigation should jump rather than fly. Then toggle the OS setting mid-session — all three should follow without a reload. That liveness is the whole reason for the custom hook, and it is the one thing no unit test covers.animationName: noneas "already finished". Open and dismiss a nested drawer a few times and confirm nothing is left mounted or stranded half-open.languageprop beside it).WCAG status against the readiness report's four AA failures
langon the embedded subtree (3.1.2)Widget.tsx, not in this ticket's scopeprefers-reduced-motion(2.3.3)Plus six of §5's should-fix items. Still open from that list: landmarks/skip link, and no automated a11y checks (no axe in CI or Ladle).
Notes for reviewer
Deliberately not done, each with a reason:
stripLabelduplicatesDrawerChrome's title switch (flagged by the reuse and altitude passes, and a fair hit — drift between them would produce exactly the mismatched-name class of bug this PR fixes). Merging them means touchingviews/fallbacks.tsx, reconciling a second i18n namespace and itsdefaultValuepolicy. Left as a follow-up rather than restructuring a critical error path with siblings in flight.announceErroras a per-call-site boolean rather than derived from the form's validation mode via context. The current shape is fail-safe (default on); the deeper fix is a larger redesign.vaul.css, notglobals.css, despite that file being vendored. It is at the foot, below a divider, and the file header's refresh instructions were updated to say so.RadioGroup's error is announced but notaria-describedby-wired — the composite field has no single id, and inventing one gives a<label for>pointing at nothing.Sibling coordination: edits here are confined to
RegistrationForm's submit/focus logic, clear of #105's confirmation-screen region. Three additivecommonlocale keys across all ten locales.Closes #102
🤖 Generated with Claude Code