Skip to content

fix(a11y): name every dialog after its title - #377

Merged
Hakanbaban53 merged 1 commit into
Zarestia-Dev:masterfrom
repires:fix/dialog-names
Nov 25, 2026
Merged

Hakanbaban53 merged 1 commit into
Zarestia-Dev:masterfrom
repires:fix/dialog-names

Conversation

@repires

@repires repires commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Part of #354, as agreed there.

What

Since #373 dialogs have role="dialog", but no accessible name, so a screen reader announces just "dialog" when one opens.

The modals put their title in <header><p>…</p></header> rather than using mat-dialog-title (which would also apply Material's title styles). So instead of editing every modal, a small root service, DialogLabelsService (started from the app initializer), does what mat-dialog-title does: when a dialog opens, it gives the header's title an id and adds it to the container's aria-labelledby through the same _addAriaLabelledBy call the directive uses.

  • A dialog without a header, the confirm dialog, is named by its first h1/h2 (its title).
  • Preferences shows its tabs instead of a title on wide windows, so it opens with ariaLabel: "Preferences" (the existing title string).
  • A dialog opened with an ariaLabel keeps it; one with no title is left alone rather than guessed.

No visual change and no new strings.

Tests

  • New dialog-labels.service.spec.ts: a dialog is named by its header title (not its close button or body), a dialog without a header by its heading, an ariaLabel is kept, and an untitled dialog gets no label. The first fails without the service.
  • Checked in the headless UI with Playwright: Quick Add Remote, Add New Remote, Export Settings, Preferences, Keyboard Shortcuts, About, Alerts & Notifications, Configuration Vault, Rclone Flags, RC Console, Backend Management and a confirm dialog ("Reset Flags") are each announced by their title.
  • Full suite (3674 tests), ESLint, Prettier and ng build pass.

Dialogs had role="dialog" (Zarestia-Dev#373) but no accessible name, so screen
readers announced only "dialog" (Zarestia-Dev#354). Modals put their title in
<header><p>, not mat-dialog-title (which would also restyle it), so
DialogLabelsService links that title to the dialog the way the
directive does, through the container's aria-labelledby queue. A dialog
without a header (the confirm dialog) is named by its first h1 or h2.
Preferences shows its tabs instead of a title on wide windows, so it
opens with its title as aria-label.
@Hakanbaban53
Hakanbaban53 merged commit 2208dbe into Zarestia-Dev:master Nov 25, 2026
6 checks passed
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.

2 participants