Skip to content

[test][dialog] Add axe tests and WCAG conformance report - #49975

Draft
michelengelen wants to merge 5 commits into
mui:masterfrom
michelengelen:feature/mat-2030-a11ydialog-assess-wcag-22-conformance
Draft

michelengelen wants to merge 5 commits into
mui:masterfrom
michelengelen:feature/mat-2030-a11ydialog-assess-wcag-22-conformance

Conversation

@michelengelen

@michelengelen michelengelen commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Adds axe coverage, WCAG unit tests, and a WCAG 2.2 Level A/AA conformance report for Dialog. This is Wave 2, item 1 of #49260. Part of #49416.

Dialog

Result Count
✅ Supports 16
⚠️ Partially Supports 2
❌ Does Not Support 0
➖ Not Applicable 37
🚩 Flagged 2/18

Known gaps, each confirmed in Chromium:

  • 2.1.1 Keyboard. With scroll="paper", DialogContent is the scroll container, and it is not focusable. If the content has no focusable element, keyboard users cannot scroll it. scroll="body" works, and tabIndex={0} on DialogContent works.
  • 4.1.2 Name, Role, Value. A Dialog without a DialogTitle has no accessible name. Its aria-labelledby points to no element, and an aria-label on Dialog goes to the root element, not to the element with the dialog role. A DialogTitle with its own id names the Dialog only when the Dialog has the same aria-labelledby.

Report: Dialog/accessibility.md

Changes

  • Modal tests. Modal.test.js has a new "WCAG 2.2 conformance" block for 1.3.1, 2.1.1, 2.1.2, 2.4.3, and 3.2.1.
    • The tests cover the hidden page, Escape, the focus trap, and the focus restore.
    • The Dialog claim lists Modal in tests, so the scorecard reads them as Dialog evidence. Drawer, Menu, and Popover can do the same.
  • Dialog tests. The Dialog.test.js "WCAG 2.2 conformance" block covers 1.3.1, 1.4.3, 2.4.3, 2.5.2, and 4.1.2.
    • The 1.4.3 tests read the rendered colors in the browser, in light mode and in dark mode.
    • Two tests pin the 4.1.2 gap and fail when the gap is fixed.
  • axe. Six fixtures render an open Dialog with disablePortal, because axe scans only the test case element.
    • DialogA11yOpen, DialogA11yFullScreen, and DialogA11yScrollBody assert every rule.
    • DialogA11yScroll records color-contrast without asserting it. axe cannot rate text that the scroll container clips.
    • DialogA11yScrollText also records scrollable-region-focusable. This is the 2.1.1 gap.
    • DialogA11yKnownGaps records aria-prohibited-attr and aria-valid-attr-value. This is the 4.1.2 gap.
  • Playwright. Dialog is in the CSS layout suite on DialogA11yOpen. Five tests in index.test.js use real key presses:
    • Focus moves into the dialog, stays in it, and goes back to the trigger (2.1.2, 2.4.3).
    • The title and the actions do not cover a focused link in scrolling content (2.4.11).
    • At 320 CSS px, the dialog fits in the viewport and scrolls vertically only (1.4.10).
    • The keyboard scrolls text-only content with scroll="body" (2.1.1).
    • A tripwire test expects the 2.1.1 gap with scroll="paper". It fails when the gap is fixed.
  • Docs. The full-screen demo had no accessible name. Its Dialog now has aria-labelledby, and its title is an h2. The Accessibility section of dialogs.md has three new notes: how DialogTitle names the Dialog, how to name a Dialog without a DialogTitle, and how to make text-only content keyboard scrollable.
  • Known gaps. Two new rows.

Decisions for review

  • The notes marked "Modal" are written for reuse. The issue asks for this. Drawer, Menu, and Popover can refer to them.
  • 2.4.7 is ✅ and flagged. On open, focus moves to the paper, which has the dialog role and shows no focus indicator. The paper is a container, not a control, and the first Tab moves to a control. An auditor review of this decision is pending.
  • 1.3.2 is ✅, Shared, and flagged. The Dialog renders in a portal at the end of body. Focus moves into it, and the page behind it is hidden from assistive technology. A screen-reader check of the reading order is pending.
  • 2.1.1 and 2.5.8 are Hybrid. Unit tests cover Escape, and the manual steps cover the scroll cases and the backdrop.
  • The docs demos are not enrolled for axe. They render a closed Dialog, so axe sees only the trigger button.
  • The dedicated 1.4.10 test is necessary. The layout suite measures the page root, so it does not see a Dialog with a fixed position.

Not done in this PR

  • The screen-reader checks from the issue have steps and pass conditions in the report. Nobody has run them with NVDA or VoiceOver yet. The recorded results come from Chromium.
  • The browser tests ran in Chromium only on my machine. CI covers the other browsers.

Follow-ups

  • Component: put an aria-label on Dialog on the element with the dialog role.
  • Component: do not set aria-labelledby when the Dialog has no DialogTitle.
  • Component: make text-only content keyboard scrollable with scroll="paper".
  • Modal: when the focus trap returns focus, the focus goes to the root element, which has role="none".

Merge order

The Tooltip PR for the same wave (#49976) changes the same generated files. Do not merge the generated blocks by hand. After a rebase, run pnpm a11y:scorecard.

🤖 Generated with Claude Code

michelengelen and others added 4 commits December 4, 2026 15:06
The tests cover the hidden page (1.3.1), Escape (2.1.1), the focus trap (2.1.2), the focus restore (2.4.3), and focus without a close (3.2.1).

Each title has the criterion number and name, so the accessibility scorecard reads the tests as evidence. A component that uses Modal can list Modal in the `tests` key of its claim.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Add six open Dialog fixtures for axe and one interaction fixture for Playwright. The fixtures use `disablePortal`, because axe scans only the test case element.

Add unit tests for 1.3.1, 1.4.3, 2.4.3, 2.5.2, and 4.1.2. Add Playwright tests for the focus order, focus not obscured, reflow at 320 CSS px, and keyboard scroll. Enroll Dialog in the CSS layout suite.

Two unit tests and one Playwright test pin the documented gaps. They fail when a gap is fixed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The full-screen demo has no DialogTitle, so its Dialog had no accessible name. The Dialog now has `aria-labelledby`, and the title is an `h2`.

The Accessibility section now explains how to name a Dialog without a DialogTitle, and how to make text-only content keyboard scrollable with `scroll="paper"`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Add the Dialog claim, the report, and the axe results. Add two known-gap rows for 2.1.1 and 4.1.2. Regenerate the scorecard, the index, and the manual-testing checklist.

The notes marked Modal in the report also apply to Drawer, Menu, and Popover.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@code-infra-dashboard

code-infra-dashboard Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

No regressions in 32 benchmarks · precise to ±9.7% (±15.8% at worst) · ran 3m 38s · details


Check out the code infra dashboard for more information about this PR.

A regression run wrote the file again after the format step. The CI check for committed a11y results then failed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y scope: dialog Changes related to the dialog. test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant