Skip to content

[P1][a11y] Dialogs don't trap focus, don't take focus when opened, and mostly ignore Escape #701

Closed

Description

@EVWorth

Counted across the 17 *Dialog.tsx components:

behaviour dialogs with it
Focus trap 0 of 17
Focus moved into the dialog on open 1 of 17
Escape closes 4 of 17
Backdrop click closes 13 of 17
role="dialog" / aria-modal 0 of 17

What this means for a keyboard user

Open a dialog and focus stays wherever it was — behind the dialog. Tab walks
through the page underneath, which is still fully focusable, while the dialog
sits on top. There is no way to reach the dialog's own controls except with
the mouse, and in 13 of 17 the only reliable way out is clicking the backdrop.

DESIGN_REQUIREMENTS.md §1.3 commits to the opposite:

Keyboard-Driven — Power users live on the keyboard. Every action is
accessible via keyboard shortcut. Mouse is supported but never required.

For dialogs, the mouse is currently required.

Without role="dialog"/aria-modal, a screen reader is not told a modal
opened at all, and keeps reading the page behind it.

Fix

One shared <Modal> wrapper that owns the whole contract, rather than 17
partial implementations:

  • role="dialog" + aria-modal="true" + aria-labelledby pointing at the title
  • move focus to the dialog (or its first field) on open
  • trap Tab and Shift+Tab within it
  • Escape closes
  • restore focus to the invoking element on close

Mechanical to apply once it exists: the dialogs already share a shape
(backdrop div, panel div, header with a close button), so most become a
wrapper swap.

Worth adding

A shared test helper asserting the contract, run against every dialog. The
count above came from grep, which is exactly the kind of thing a test should
be asserting instead.

Found during the UI review.

Activity

  1. added
    audit
    severity/p1
    kind/a11y
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cross-cuttingauditkind/a11yseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions