Skip to content

[test][fab] Add axe tests and WCAG conformance report - #49550

Merged
michelengelen merged 14 commits into
mui:masterfrom
michelengelen:feature/mat-2020-a11yfab-assess-wcag-22-conformance
Nov 27, 2026
Merged

michelengelen merged 14 commits into
mui:masterfrom
michelengelen:feature/mat-2020-a11yfab-assess-wcag-22-conformance

Conversation

@michelengelen

@michelengelen michelengelen commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

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

Fab

Result Count
✅ Supports 21
⚠️ Partially Supports 4
❌ Does Not Support 0
➖ Not Applicable 30
🚩 Flagged 6/25

Known gaps:

  • 1.4.3 Contrast (Minimum). Extended labels in info (3.86:1) and warning (3.11:1) are less than 4.5:1, as for a contained Button. On keyboard focus, the focus ripple behind the label lowers every palette color below 4.5:1, for example primary to 2.80:1. disableFocusRipple with the focusVisible ring fixes this.
  • 1.4.10, 1.4.12. The extended Fab has a fixed height. A label can wrap at 320 px, or with the WCAG letter and word spacing. Two lines of glyphs stay inside the Fab, and at 320 px they reach the edges of the small size. Three lines spill out of every size, and the white text can become invisible on the page. height: 'auto', minHeight: 48, and vertical padding fix it.
  • 1.4.11 Non-text Contrast. The default focus ripple is 1.39:1 to 1.85:1 against the fill. The box-shadow does not change on focus. The focusVisible ring does not remove the ripple, so the fix is the ring plus disableFocusRipple.

Report: Fab/accessibility.md

Changes

  • Tests. The Fab.test.js "WCAG 2.2 conformance" block covers 1.1.1, 1.4.3, 1.4.11, 2.1.1, 2.1.2, 2.4.3, 2.5.2, 2.5.3, 3.2.1, 3.2.2, and 4.1.2. The 3.2.2 test toggles aria-pressed with Enter and checks that focus stays. The 1.4.3 test classifies the rendered extended-Fab colors against the palette contrast contract, so the known failing set cannot drift. The 1.4.11 test checks that the icon reaches 3:1 against the fill at rest. It runs only in the browser test projects.
  • axe. Three docs demos and three fixtures are enrolled with assertions: 'all'. FabA11yColorMatrix and FabA11yLongLabel record color-contrast without asserting it, because both show documented gaps. FloatingActionButtonZoom is left out, because most of it is Tabs.
  • 1.4.4 is tested two ways (new in the layout suite). Each layout suite now runs a 200% page-zoom check (the viewport is halved, as browser zoom does) next to the 200% text-only check. Page zoom decides the 1.4.4 rating (WCAG technique G142). A suite can turn off the text-only check with textOnlyResize: false, and the report then states the text-only result.
    • Avatar used skipCriteria: ['1.4.4'] because its px box does not scale under text-only resize. It now uses textOnlyResize: false, and its 1.4.4 rating becomes Automated and unflagged.
    • Fab 1.4.4 is ✅: under page zoom the height scales with the label. The report states the text-only spill.
  • Playwright. Fab is in the CSS layout suite on FloatingActionButtonExtendedSize, in the 2.4.7 focus-visible suite, and in the theme.focusVisible ring suite.
    • The page-zoom, text-only, and text-spacing checks now also fail when text spills out of a box that shows its overflow. Before, they found only text that a box with hidden overflow clips. Above and below a box, only text that wraps counts, because one line can have a line box taller than a small box while its glyphs stay inside.
    • The FabA11yLongLabel screenshot records the long-label gap. It has three 280 px columns: each label fits on one line at the default settings, then wraps to two lines with the WCAG text-spacing values, and wraps and spills with 200% text (a nested theme with htmlFontSize: 8).
    • A tripwire test on FabA11yLongLabel proves that the spill check detects this gap. It fails when the extended Fab starts to grow with its label.
  • Known gaps. There is a new row for the fixed-height extended Fab. Fab is added to the focus-indicator and palette rows, with notes about disableFocusRipple.

Decisions for review

  • Page zoom decides 1.4.4. WCAG accepts browser zoom as sufficient (G142). The text-only result stays visible in each report, so readers who test with text-only resize see it.
  • 1.4.10 and 1.4.12 are ⚠️ · ● Component. The fixed height in Fab.js causes the spill. The author chooses the label, but the component does not grow with it.
  • 2.4.11 stays ✅ · ○ Author. The component does not set a position. The report explains that a fixed Fab hides focused elements, and that scroll-padding-bottom fixes it.

Merge order with the sibling Wave 1 PRs

This branch includes master, with the IconButton (#49549), Link (#49555), and FormLabel (#49552) PRs. The Chip and ButtonGroup PRs edit some of the same places in KeyboardRing.js, FOCUS_RING_TARGETS, criteriaSuites.mjs, demoMeta.ts, demoMeta.test.ts, and knownGaps.json. After one of them merges, resolve the conflicts by keeping both sides. The Chip PR (#49556) rates its 1.4.4 by page zoom with a manual step, and can switch to the automated check after this PR merges.

Do not hand-merge the generated blocks: the docs-page tables, the rollup sentence, scorecard.json, src/accessibility.md, and manual-testing.md. Two PRs can produce the same line for different reasons, for example "26 Supports, 6 Partially Supports". Git then merges that line without a conflict, and the result is wrong. After each rebase, run pnpm a11y:scorecard.

Not done in this PR

  • The screen-reader and manual checks from the issue have steps and pass conditions in the report. Nobody has run them yet.
  • Argos will show a baseline change for /regression-FocusVisible/KeyboardRing, and a new screenshot for FabA11yLongLabel.

Follow-ups (tracked in #49477)

  • Replace the fixed height of the extended Fab with minHeight in the component.
  • The Button report should document the ripple-over-label contrast on focus and press.

🤖 Generated with Claude Code

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

code-infra-dashboard Bot commented Oct 24, 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 ±7.9% (±12.5% at worst) · ran 4m 51s · details


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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@siriwatknp siriwatknp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran pnpm a11y:scorecard on this branch and again after merging latest master, the generated files are up to date in both runs. The ratings also match Fab.js.

Left one question about the 1.4.4 page zoom check and a few small test nits.

Comment thread test/regressions/index.test.js Resolved
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 26, 2026
Comment thread test/regressions/index.test.js Resolved
michelengelen and others added 6 commits November 26, 2026 15:27
Keep both sides in the files that the IconButton PR (mui#49549) also edits. Take the lockfile from master. Regenerate the scorecard files with pnpm a11y:scorecard.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 27, 2026
Master now has the Link PR (mui#49555). Keep both sides in knownGaps.json. Regenerate the scorecard files with pnpm a11y:scorecard.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 27, 2026
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 27, 2026
Comment thread test/regressions/index.test.js Resolved
@michelengelen
michelengelen enabled auto-merge (squash) November 27, 2026 09:45

@LukasTy LukasTy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small nit.
I can approve the PR if you don't fancy addressing that correctness issue. 😊

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 27, 2026
Master now has the FormLabel PR (mui#49552). Keep both sides in the files that it also edits. Regenerate the scorecard files with pnpm a11y:scorecard.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 27, 2026
@michelengelen
michelengelen merged commit 43ba994 into mui:master Nov 27, 2026
23 checks passed
@michelengelen
michelengelen deleted the feature/mat-2020-a11yfab-assess-wcag-22-conformance branch November 27, 2026 10:58
michelengelen added a commit to michelengelen/material-ui that referenced this pull request Nov 27, 2026
…formance

Master now has the Fab PR (mui#49550). Keep both sides in the files that it also edits. Regenerate the scorecard files with pnpm a11y:scorecard.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
michelengelen added a commit to michelengelen/material-ui that referenced this pull request Nov 27, 2026
…conformance

Master now has the Fab PR (mui#49550). Keep both sides in the files that it also edits. Regenerate the scorecard files with pnpm a11y:scorecard.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
michelengelen added a commit to michelengelen/material-ui that referenced this pull request Nov 27, 2026
…rmance

Master now has the Fab PR (mui#49550). Keep both sides in the files that it also edits. Regenerate the scorecard files with pnpm a11y:scorecard.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
michelengelen added a commit to michelengelen/material-ui that referenced this pull request Nov 27, 2026
Master now has the Fab PR (mui#49550). Keep both sides in the files that it also edits. Regenerate the scorecard files with pnpm a11y:scorecard.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants