Skip to content

fix(platform): a11y polish — aria-modal, radiogroup arrows, single preview heading, protected-row checkbox (#1998) - #2203

Merged
yannickmonney merged 2 commits into
mainfrom
tale/xs79tj369svw3b42xz3qmftpnn89f51v
Jun 29, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
tale/xs79tj369svw3b42xz3qmftpnn89f51v

Conversation

@larryro

@larryro larryro commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What & why

Resolves the four accessibility refinements from the keyboard/AT sweep in #1998 (none block a task; all WCAG 2.1 AA polish).

1. aria-modal="true" on modal dialogs

Radix does not emit aria-modal in this version (verified: the dialog content rendered with aria-modal=null). Added it to every modal dialog primitive:

  • platform Dialog (components/ui/dialog/dialog.tsx)
  • platform Sheet (components/ui/overlays/sheet.tsx)
  • @tale/ui ResponsiveDialog — both the desktop Radix dialog and the mobile vaul drawer content.

2. Run-code "Default Mode" radiogroup — arrow-key navigation

The platform RadioGroup already delegates to Radix RadioGroupPrimitive, which provides roving-tabindex arrow navigation. Confirmed empirically in real Chromium (a native ArrowDown keydown on the focused radio moves selection and fires onValueChange). The reported failure reproduced only with userEvent.keyboard('{ArrowDown}'), which doesn't drive Radix's RovingFocusGroup under the test runner — a harness artifact, not an app bug. Added a real-Chromium regression test (radio-group.browser.test.tsx) to lock the behaviour in and guard against a future swap to hand-rolled radios.

3. Duplicate "Document preview" heading

The Dialog renders a visually-hidden DialogTitle (an <h2>) for its accessible name; the document-preview custom header also rendered a visible <Heading level={2}> with the same text, so AT exposed the heading twice. The visible title is now a styled <span>, leaving the hidden DialogTitle as the single heading.

4. Fake "Select row" checkbox on protected rows

The shared select column rendered an inert Checkbox (with a "Select row" label) even on rows gated out by the table's enableRowSelection predicate — a false affordance on protected agent rows. The cell now renders nothing when row.getCanSelect() is false. Tables without per-row gating are unaffected.

Tests

  • bun run --filter @tale/platform typecheck, lint — green; @tale/ui typecheck, lint — green.
  • Client (jsdom) project: aria-modal assertions on Dialog + Sheet; new DocumentPreviewDialog test (heading exposed once); new DataTable row-selection tests (checkbox only on selectable rows). 208 passed.
  • Browser (real Chromium) project: new RadioGroup arrow-key navigation tests + existing form-dialog focus-trap. All passed.
  • @tale/ui: ResponsiveDialog aria-modal assertions (desktop + mobile drawer). 6 passed.

Ripple Map

No user-visible strings, env vars, Convex/knowledge schema, or org-config schema changed — i18n, docs, README, and migrations are N/A. Change spans @tale/ui (responsive-dialog) alongside the platform app.

Closes #1998

…nd protected rows (#1998)

Four accessibility refinements found in the keyboard/AT sweep:

- Add `aria-modal="true"` to the modal dialog primitives (platform `Dialog`,
  `Sheet`, and `@tale/ui` `ResponsiveDialog` desktop dialog + mobile drawer)
  — Radix does not set it for us in this version.
- Lock in arrow-key navigation for the run-code "Default Mode" radiogroup with
  a real-Chromium regression test. The platform `RadioGroup` already provides
  roving-tabindex via Radix `RadioGroupPrimitive`; the test guards against a
  future swap to hand-rolled radios.
- Render the document-preview heading once: the visible title is now a styled
  span, so the dialog's single accessible heading is the visually-hidden
  `DialogTitle`, instead of exposing "Document preview" twice.
- Hide the select-row checkbox on non-selectable rows in the shared select
  column (`row.getCanSelect()`), removing the false "Select row" affordance on
  protected agent rows.

No user-visible strings, env vars, schema, or config changed — i18n, docs and
migrations are N/A. Touches `@tale/ui` (responsive-dialog) alongside platform.

Closes #1998
@larryro

larryro commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Desk Review — PR #2203 (issue #1998: accessibility polish)

Verdict: NOT READY — one blocking gap in item 1 (aria-modal coverage). The four implemented items are well-built, tested, and the CI is fully green — but a prominent modal (the global/chat SearchCommand palette) was left out of the aria-modal change, so issue item 1 ("Modal dialogs omit aria-modal") is not fully resolved.

Verification performed

  • CI: all required checks green (gh pr checks) — Unit, UI, Browser, Type check, Lint, Format, Knip, Build platform, all 16 Playwright (platform) shards, Storybook, etc. The only non-green entries are fork-PR-only jobs (Smoke test (fork PR), Validate images (fork PR)) and Trivy, which legitimately skip on same-repo PRs.
  • Tests run locally (all pass):
    • vitest --run --config vitest.ui.config.ts on the 4 affected UI specs → 29 passed
    • vitest --run --project browser radio-group.browser.test.tsx → 2 passed (real Chromium)
    • vitest --run on packages/ui responsive-dialog.test.tsx → 6 passed

What's correct (verified by reading the surrounding code + node_modules)

  1. aria-modal on the shared primitives — Dialog, Sheet, and ResponsiveDialog (both desktop Dialog and mobile Drawer branches). Radix/vaul do not set aria-modal automatically, all three Roots are modal-by-default with no modal={false} escape, and the attribute is placed before any prop spread so a caller can't clobber it. Correct and safe.
  2. getCanSelect() on protected rows — createSelectColumn now renders the checkbox only when row.getCanSelect() is true. Correct TanStack v8 API; it mirrors the enableRowSelection predicate, and the header select-all already filtered to selectable rows, so no new inconsistency. Returning null keeps the fixed-width utility cell; no layout/colspan regression. Row-click still fires for non-selectable rows.
  3. Duplicate preview heading — the visible title is now <Text as="span"> while the dialog's single semantic heading is the visually-hidden DialogTitle rendered from title (same t('preview.title') string). Dialog keeps its accessible name; the removed Heading import was the only usage; visual weight is preserved. Confirmed the new test would fail (2 headings) if reverted — it is not vacuous: customHeader renders in every branch.
  4. Radiogroup arrow-keys — the platform RadioGroup already delegates roving-tabindex to Radix; the PR adds a real-Chromium regression test (forward + wrap). The behavior is genuinely verified, not just asserted.

BLOCKING

  1. SearchCommand modal is missing aria-modal="true" — packages/ui/src/components/search/search-command.tsx:212. This is a genuine modal: Dialog.Root (Radix, modal defaults to true) with a full-screen bg-black/50 backdrop-blur overlay and focus trap; <Dialog.Content asChild aria-label={labels.title}> sets only aria-label, not aria-modal. It's the shared global/chat search palette (consumed by chat-header.tsx) — exactly the keyboard/AT surface this issue's sweep targets — and it does not route through the shared Dialog component, so fixing the primitives did not cover it. After this PR it is the only true modal Content surface still missing the attribute (mermaid-fullscreen and online-gate already set aria-modal; pdf-link-popup is a non-modal popover and correctly omits it). Fix: add aria-modal="true" to the Dialog.Content at search-command.tsx:212 (it forwards onto the asChild child), and add a coverage assertion mirroring the other dialog specs.

Non-blocking nits (not required for merge)

  • radio-group.browser.test.tsx uses fixed setTimeout waits (10ms/60ms) rather than waitFor; works and passed in CI + locally, but a polling wait would be less timing-fragile. The consumer (run-code-policy.tsx) conditionally disables options — a disabled-item-skip case would round out the roving-nav coverage.
  • data-table.test.tsx casts bobRow as HTMLElement after only a not.toBeNull() check; an explicit throw/guard would be cleaner. A "no rows selectable" case would complete the matrix.

NOT READY — CHANGES REQUIRED

  1. Add aria-modal="true" to the Dialog.Content in packages/ui/src/components/search/search-command.tsx:212 (the global SearchCommand modal), so issue Improvement: Accessibility polish — aria-modal on dialogs, run-code radiogroup arrow-keys, duplicate preview heading, fake checkbox on protected rows #1998 item 1 covers every modal dialog, not just the three shared primitives. Add a test asserting aria-modal="true" on its dialog, matching the dialog/sheet/responsive-dialog specs.

@larryro

larryro commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Desk review — #1998 accessibility polish

Verdict: READY TO MERGE.

Reviewed the full implementation on this branch (head d272b2d3), not just the diff's happy line. Two-round review (5 breadth subagents across correctness / robustness / elegance / tests / boundaries, then independent confirmation of every flagged item). CI and the project's own tests verified locally.

CI

All required checks green on head d272b2d3 (gh pr checks): Build (all images), Lint, Format, Type check, Knip, Storybook, Unit, UI, Browser, Migrations, Opengrep/CodeQL SAST, and all 16 Playwright platform shards + web/docs. Only */fork PR jobs are SKIPPED and Trivy is NEUTRAL — both expected, not failures.

Tests run locally (all pass)

  • Platform jsdom (bunx vitest --run --config vitest.ui.config.ts on dialog / sheet / data-table / document-preview-dialog tests): 29 passed.
  • packages/ui unit (bunx vitest --run --project unit on responsive-dialog / search-command): 25 passed.
  • Radiogroup real-Chromium (bunx vitest --run --project browser radio-group.browser.test.tsx): 2 passed.

Findings — all four issue points genuinely resolved

  1. aria-modal — added to dialog.tsx, sheet.tsx, responsive-dialog.tsx (both the vaul drawer and the desktop Dialog variants) and search-command.tsx. All four surfaces are always-modal (no modal={false} path exists), so hardcoding aria-modal="true" is correct. Each has a test asserting the attribute is present.
  2. Run-code default-mode radiogroup — correctly a test-only change. The run-code policy picker (run-code-policy.tsx) renders through the shared RadioGroup, which already delegates to Radix RadioGroupPrimitive (roving tabindex → working arrow keys); the new radio-group.browser.test.tsx is a meaningful regression guard (tests next-move and wrap-around with native key events, and would fail against a hand-rolled radio swap).
  3. Duplicate preview heading — the visible title is now <Text as="span">; the single accessible heading is the visually-hidden DialogPrimitive.Title the Dialog renders from title (still passed). Heading import cleanly removed; styling preserved. Test asserts exactly one heading named "Document preview".
  4. Fake checkbox on protected rows — select-column cell now renders the checkbox only when row.getCanSelect(), else null. Correct TanStack predicate; select-all header and indeterminate state already count only selectable rows; skeleton placeholder path is independent of cell content. Test covers both branches (non-selectable row → no checkbox; selectable rows → checkbox) and fails against the old always-render code.

Non-blocking notes (do not block merge)

  • The explicit aria-modal="true" on the Radix Dialog.Content surfaces is partly redundant with Radix's own modal attribute, but harmless, explicit, and exactly what the issue requested; the vaul drawer addition is genuinely needed.
  • A separate hand-rolled radio control exists in features/chat/components/external-agent-mode-toggle.tsx without arrow-key support — but that is the chat agent-mode toggle, not the run-code default-mode picker named in this issue, so it is out of scope for Improvement: Accessibility polish — aria-modal on dialogs, run-code radiogroup arrow-keys, duplicate preview heading, fake checkbox on protected rows #1998.
  • A reviewer flagged a "missing useT mock" in document-preview-dialog.test.tsx; confirmed a non-issue — the shared tests/utils/render wraps an I18nextProvider, and the test passes.

READY TO MERGE.

@yannickmonney
yannickmonney merged commit 04597f4 into main Jun 29, 2026
51 checks passed
@yannickmonney
yannickmonney deleted the tale/xs79tj369svw3b42xz3qmftpnn89f51v branch June 29, 2026 17:19
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.

Improvement: Accessibility polish — aria-modal on dialogs, run-code radiogroup arrow-keys, duplicate preview heading, fake checkbox on protected rows

2 participants