fix(a11y): silence Radix Dialog warnings + add missing index.code key (#7835)#7836
Conversation
Closes #7835. - src/locales/en.json: add `index.code` (referenced by src/templates/index.html for the session-receive code input but never defined, producing a "Couldn't find translation key" console error on the landing page). - admin/src/utils/LoadingScreen.tsx, admin/src/pages/PadPage.tsx, admin/src/pages/AuthorPage.tsx: every @radix-ui/react-dialog `Dialog.Content` now has a `Dialog.Title` and `Dialog.Description` (visually hidden via `@radix-ui/react-visually-hidden` where there is no visible heading), silencing Radix's a11y console warnings on every admin page load. - src/tests/backend-new/specs/template-l10n-keys.test.ts: regression coverage — fails CI if any `data-l10n-id` in `src/templates/*.html` is missing from `src/locales/en.json`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Review Summary by QodoFix Radix Dialog a11y warnings and missing translation key
WalkthroughsDescription• Add missing index.code translation key to fix landing page console error • Add Dialog.Title and Dialog.Description to all Radix dialogs in admin app - Wrap titles/descriptions in VisuallyHidden where no visible heading exists - Silences Radix a11y warnings on every admin page load • Add regression test scanning templates for missing translation keys • Add new translation keys for dialog accessibility in admin app Diagramflowchart LR
A["Missing translation keys<br/>and Dialog a11y warnings"] -->|Add Dialog.Title<br/>Dialog.Description| B["Admin dialogs<br/>fully accessible"]
A -->|Add index.code key| C["Landing page<br/>no console errors"]
A -->|Add regression test| D["CI prevents<br/>future regressions"]
File Changes1. src/tests/backend-new/specs/template-l10n-keys.test.ts
|
Code Review by Qodo
Context used✅ Tickets:
🎫 console errors/warnings 1. 4-space indent in test
|
Summary
Closes #7835.
Three console warnings reported on Etherpad 3.2.0:
Couldn't find translation key index.code—src/templates/index.html:200referenceddata-l10n-id="index.code"(the label for the session-receive code input) butsrc/locales/en.jsonnever defined the key. Added it.DialogContent requires a DialogTitle— every@radix-ui/react-dialogDialog.Contentin the admin SPA now has aDialog.Title. Where there is no visible heading, the title is wrapped in@radix-ui/react-visually-hiddenso screen readers still get a label without changing the UI.Missing Description or aria-describedby for DialogContent— same treatment forDialog.Description.Sites fixed (all in the admin app, which is what fires these warnings — the public landing page itself uses native
<dialog>):admin/src/utils/LoadingScreen.tsx(renders on every admin route)admin/src/pages/PadPage.tsx— delete confirmation, error dialog, create-pad dialogadmin/src/pages/AuthorPage.tsx— erasure confirmation dialog (also restructured so a Title exists in the loading-preview phase)New translation keys land in
src/locales/en.json(translationnamespace, Crowdin-managed) andadmin/public/ep_admin_authors/en.json(ep_admin_authorsnamespace).Regression coverage
Added
src/tests/backend-new/specs/template-l10n-keys.test.ts. It scans everysrc/templates/*.htmlfordata-l10n-id="..."attributes and asserts each one resolves insrc/locales/en.json. Verified locally that removingindex.codefrom en.json makes the test fail; restoring it passes.Test plan
pnpm test:vitest run tests/backend-new/specs/template-l10n-keys.test.ts(5/5 pass; 1/5 fails on purpose when key removed)pnpm test:vitest run— 716/717 pass; one pre-existing failure in `backend-tests-glob.test.ts` due to no plugins in this fresh clone (unrelated)