fix(a11y): wrap matrix DialogTitle in Radix VisuallyHidden - #9
Merged
Merged
Conversation
Harden the shared matrix Dialog primitive (Gap / Capture / Export) so the accessible Title is guaranteed present in the accessibility tree regardless of how the project's `sr-only` utility is defined. Replace the `<RadixDialog.Title className="sr-only">` with Radix's own recommended `<VisuallyHidden asChild><RadixDialog.Title>` pattern, which is the wrapper Radix points to in its DialogContent-requires-a-Title warning. The Title stays visually hidden (1x1, clipped) so there is zero layout or behavior change: focus still moves in, Tab stays trapped, Escape closes, and focus restores to the trigger. Verified empirically in-browser across all three modals (0 console errors / warnings, names announced, behavior intact). Adds @radix-ui/react-visually-hidden as a direct dependency (it was already present transitively via react-dialog). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What & why
A11y-only hardening of the shared matrix
Dialogprimitive (src/components/ui/Dialog.tsx) used by the three Skills-matrix modals (Gap / Capture / Export).Radix's
DialogContentwarns when it cannot find itsDialogTitlein the DOM (document.getElementById(titleId)), pointing you to wrap a hidden title with itsVisuallyHiddencomponent. This PR adopts that exact recommended pattern, replacing the project-sr-only-classed Title with Radix's ownVisuallyHidden:The Title stays visually hidden (renders 1x1, clipped) so there is zero layout or behavior change. This makes the accessible name robust regardless of how the project's
sr-onlyutility is defined now or in the future, which is the canonical Radix guidance.Changes
src/components/ui/Dialog.tsx— useVisuallyHidden asChildaroundRadixDialog.Title; updated the doc comment to match.package.json/package-lock.json— add@radix-ui/react-visually-hiddenas a direct dependency (it was already present transitively via@radix-ui/react-dialog).No other files touched.
src/lib/labs/mcclean.tsuntouched. Zero em-dashes. joVE | LabOS design system preserved.Verification (empirical, in-browser)
Ran the app locally and opened each of the three modals via the real triggers (coverage-gap cell, "Launch tacit capture", and Compliance-on -> "Form 483 audit export").
The VisuallyHidden Title renders at 1x1 (clipped) and the dialog's
aria-labelledbyresolves to it, so screen-reader users get the name while sighted layout is identical.CI parity (local)
tsc --noEmitcleanlintscript (CI skips it, matchingmain)next buildsucceeds (all 9 static pages generated)npm ci --dry-runconfirms lockfile in sync🤖 Generated with Claude Code