Skip to content

[test][button group] Add axe tests and WCAG conformance report - #49551

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

michelengelen merged 14 commits into
mui:masterfrom
michelengelen:feature/mat-2021-a11ybuttongroup-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 ButtonGroup. This is Wave 1, item 3 of #49260. Part of #49407.

ButtonGroup

Result Count
✅ Supports 7
⚠️ Partially Supports 2
❌ Does Not Support 0
➖ Not Applicable 27
↗ Inherited (see Button) 19
🚩 Flagged 3/9

ButtonGroup inherits the Button report and rates only what the group adds: the group role and name, the layout, and the dividers.

Known gaps:

  • 1.4.10 Reflow. A horizontal group does not wrap. A wide group makes the page scroll horizontally at 320 px. orientation="vertical" fixes it.
  • 1.4.11 Non-text Contrast. The buttons keep the Button focus ripple, and its contrast can fall below 3:1. The focusVisible theme ring fixes it. disableRipple or disableFocusRipple on the group removes the indicator from every button.
  • Inherited from Button: 1.4.3 (info and warning), 2.2.2 (the loading spinner), 2.4.3 (a focused button that turns loading loses focus), and 4.1.3 (loading).

Report: ButtonGroup/accessibility.md

Changes

  • Tests. The ButtonGroup.test.js "WCAG 2.2 conformance" block covers:
    • 1.3.1: the buttons are inside the group element.
    • 2.4.3: DOM order, and a disabled group. ButtonGroup inherits the 2.4.3 rating from Button, and these tests support the group note in the report.
    • 2.4.7: with theme.focusVisible, the focused button gets z-index: 1, so the ring paints above its neighbors. This test runs only in the browser test projects (Chromium, WebKit, and Firefox in CI).
    • 4.1.2: the group name, and that disabled passes to each button. A button with disabled={false} stays enabled.
  • axe. Seven docs demos and one fixture are enrolled with assertions: 'all'. All rules pass. The ButtonGroupA11ySemanticStates fixture covers a link button, aria-pressed toggles, a disabled group, a vertical group, and the split button attributes. ButtonGroupA11yWideGroup is not enrolled for axe: it has only plain buttons, and it exists for the 320 px screenshot.
  • Playwright. ButtonGroup is in the CSS layout suite on VariantButtonGroup, and in the 2.4.7 focus-visible suite. A new screenshot of ButtonGroupA11yWideGroup at 320 px records a five-button group that does not fit. The test viewer hides horizontal overflow, so the screenshot shows the group clipped at the right edge.
  • Scorecard fix in rollup.mjs. A group did not inherit a criterion that is not applicable by default when the parent rates it. So ButtonGroup showed Button's 2.4.4 and 4.1.3 as not applicable, which hid the loading gap. The fix changes only the ButtonGroup report: Accordion, RadioGroup, and ToggleButtonGroup stay the same. The validator in validate.mjs now accepts such a criterion in an inheriting component's notApplicable when the parent rates it, so the component can still opt out. The validator reads the parent ratings from the resolved report, so the two cannot drift.
  • SplitButton demo. The arrow button now sets aria-expanded={open}, so a screen reader announces "collapsed" while the menu is closed. Before, the attribute was missing in that state.
  • Known gaps. ButtonGroup is added to the focus-indicator row. There is a new 1.4.10 row for ButtonGroup and ToggleButtonGroup.
  • ToggleButtonGroup report. 1.4.10 changes from ✅ to ⚠️ Partially Supports, for the same reason as ButtonGroup.

Decisions for review

  • 1.4.10 is ⚠️ · ◐ Shared, for ButtonGroup and ToggleButtonGroup. A horizontal group does not wrap, so a wide group makes the page scroll horizontally at 320 px. The number of buttons is the author's choice, and orientation="vertical" fixes it. The rating is ⚠️ because the component does not reflow a wide group itself.
  • 2.4.3 is inherited, not keyed. Button rates 2.4.3 ⚠️ on master, because a focused button that turns loading loses focus. A grouped button has the same behavior, so ButtonGroup inherits the rating.
  • The dividers do not need 3:1. They are 1.13:1 to 2.39:1. Understanding 1.4.11 does not require a boundary when a label identifies each control. The Linear issue asked for 3:1. The report records the values and the reason.
  • 1.4.11 is keyed at the group level to hold the divider notes. A keyed criterion starts from the library default (⚠️), which is the same as Button's rating today. It does not follow Button automatically ([a11y] Follow-ups from the Wave 1 component assessments #49477).

Merge order with the sibling Wave 1 PRs

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.

Follow-ups (tracked in #49477)

  • The SplitButton demo menu does not close on Escape.
  • The docs demos name each group " button group", which does not describe its purpose (2.4.6).
  • Keyed group criteria start from the library defaults, not from the parent rating.
  • scripts/a11yScorecard has no unit tests. The inherits and notApplicable rules need a test project.
  • Multi-level inherits resolves only the criteria that the direct parent rates itself, not the criteria that the parent inherits.

🤖 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 ±8.9% (±13.0% at worst) · ran 3m 34s · details


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

Co-Authored-By: Claude Opus 5.5 <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 2, 2026
…a11ybuttongroup-assess-wcag-22-conformance

# Conflicts:
#	packages/mui-material/src/ButtonGroup/ButtonGroup.test.js
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 4, 2026
…formance

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread scripts/a11yScorecard/validate.mjs Resolved
Comment thread test/regressions/demoMeta.ts 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
…formance

Keep both sides in the files that the IconButton PR (mui#49549) also edits. Regenerate the scorecard files with pnpm a11y:scorecard. ButtonGroup now inherits the Button 2.2.2 rating from master.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added PR: out-of-date The pull request has merge conflicts and can't be merged. and removed PR: out-of-date The pull request has merge conflicts and can't be merged. labels Nov 27, 2026
…formance

Master now has the Link PR (mui#49555). 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 enabled auto-merge (squash) November 27, 2026 09:45
@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
…formance

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 added PR: out-of-date The pull request has merge conflicts and can't be merged. and removed PR: out-of-date The pull request has merge conflicts and can't be merged. labels 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>
@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 192202f into mui:master Nov 27, 2026
23 checks passed
@michelengelen
michelengelen deleted the feature/mat-2021-a11ybuttongroup-assess-wcag-22-conformance branch November 27, 2026 11:20
michelengelen added a commit to michelengelen/material-ui that referenced this pull request Nov 27, 2026
…conformance

Master now has the ButtonGroup PR (mui#49551) and the FormGroup PR (mui#49554). Keep both sides in the files that they also edit. 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 ButtonGroup PR (mui#49551) and the FormGroup PR (mui#49554). Keep both sides in the files that they also edit. 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