From 7f1c14cb234927fe40d1c864a7b3ea26ceb0e368 Mon Sep 17 00:00:00 2001 From: michel Date: Sat, 24 Oct 2026 09:52:25 +0200 Subject: [PATCH 01/12] [test][chip] Add axe tests and WCAG conformance report Co-Authored-By: Claude Opus 5.5 --- .../material/components/chips/chips.a11y.json | 698 ++++++++++++++++++ docs/data/material/components/chips/chips.md | 4 +- .../accessibility/accessibility.md | 27 +- .../accessibility/knownGaps.json | 37 +- .../accessibility/scorecard.json | 331 ++++++++- packages/mui-material/src/Chip/Chip.test.js | 237 ++++++ .../mui-material/src/Chip/accessibility.json | 54 ++ .../mui-material/src/Chip/accessibility.md | 539 ++++++++++++++ packages/mui-material/src/accessibility.md | 1 + packages/mui-material/src/manual-testing.md | 35 +- packages/mui-material/test/contrast.ts | 3 + test/regressions/a11y/criteriaSuites.mjs | 6 + .../fixtures/chips/ChipA11yColorMatrix.js | 19 + .../a11y/fixtures/chips/ChipA11yKnownGaps.js | 16 + .../a11y/fixtures/chips/ChipA11yLongLabel.js | 27 + .../fixtures/chips/ChipA11ySemanticStates.js | 27 + test/regressions/demoMeta.test.ts | 26 + test/regressions/demoMeta.ts | 47 ++ .../fixtures/FocusVisible/KeyboardRing.js | 2 + test/regressions/index.test.js | 55 ++ 20 files changed, 2147 insertions(+), 44 deletions(-) create mode 100644 docs/data/material/components/chips/chips.a11y.json create mode 100644 packages/mui-material/src/Chip/accessibility.json create mode 100644 packages/mui-material/src/Chip/accessibility.md create mode 100644 test/regressions/a11y/fixtures/chips/ChipA11yColorMatrix.js create mode 100644 test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js create mode 100644 test/regressions/a11y/fixtures/chips/ChipA11yLongLabel.js create mode 100644 test/regressions/a11y/fixtures/chips/ChipA11ySemanticStates.js diff --git a/docs/data/material/components/chips/chips.a11y.json b/docs/data/material/components/chips/chips.a11y.json new file mode 100644 index 00000000000000..5ead9b61cd695f --- /dev/null +++ b/docs/data/material/components/chips/chips.a11y.json @@ -0,0 +1,698 @@ +{ + "AvatarChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "incomplete", + "tags": ["wcag2aa"] + } + } + }, + "BasicChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + } + } + }, + "ChipA11yColorMatrix": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "fail", + "tags": ["wcag2aa"] + } + } + }, + "ChipA11yKnownGaps": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-command-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-deprecated-role": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-hidden-focus": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-required-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-roles": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "fail", + "tags": ["wcag2aa"] + }, + "nested-interactive": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "ChipA11yLongLabel": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-command-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-deprecated-role": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-hidden-focus": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-required-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-roles": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + }, + "nested-interactive": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "ChipA11ySemanticStates": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-command-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-deprecated-role": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-hidden-focus": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-required-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-roles": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + }, + "link-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "nested-interactive": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "ChipsArray": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-command-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-deprecated-role": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-hidden-focus": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-required-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-roles": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "avoid-inline-spacing": { + "status": "pass", + "tags": ["wcag21aa"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + }, + "list": { + "status": "pass", + "tags": ["wcag2a"] + }, + "listitem": { + "status": "pass", + "tags": ["wcag2a"] + }, + "nested-interactive": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "ClickableAndDeletableChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-command-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-deprecated-role": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-hidden-focus": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-required-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-roles": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + }, + "nested-interactive": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "ClickableChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-command-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-deprecated-role": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-required-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-roles": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + }, + "nested-interactive": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "ClickableLinkChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + }, + "link-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "ColorChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + } + } + }, + "CustomDeleteIconChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-command-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-deprecated-role": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-hidden-focus": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-required-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-roles": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + }, + "nested-interactive": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "DeletableChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-command-name": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-deprecated-role": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-hidden-focus": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-required-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-roles": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + }, + "nested-interactive": { + "status": "pass", + "tags": ["wcag2a"] + }, + "target-size": { + "status": "pass", + "tags": ["wcag22aa"] + } + } + }, + "IconChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-hidden-focus": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + } + } + }, + "MultilineChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + } + } + }, + "SizesChips": { + "rules": { + "aria-allowed-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-conditional-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-prohibited-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr": { + "status": "pass", + "tags": ["wcag2a"] + }, + "aria-valid-attr-value": { + "status": "pass", + "tags": ["wcag2a"] + }, + "color-contrast": { + "status": "pass", + "tags": ["wcag2aa"] + } + } + } +} diff --git a/docs/data/material/components/chips/chips.md b/docs/data/material/components/chips/chips.md index 0b0f5187173b5a..d4298a286b53be 100644 --- a/docs/data/material/components/chips/chips.md +++ b/docs/data/material/components/chips/chips.md @@ -100,4 +100,6 @@ gain depth while clicked or touched. ## Accessibility -If the Chip is deletable or clickable then it is a button in tab order. When the Chip is focused (for example when tabbing) releasing (`keyup` event) `Backspace` or `Delete` will call the `onDelete` handler while releasing `Escape` will blur the Chip. +If the Chip is deletable or clickable then it is a button in tab order. When the Chip is focused (for example when tabbing) releasing (`keyup` event) `Backspace` or `Delete` calls the `onDelete` handler. +After a deletion, move focus to the next chip or to a nearby control, because the deleted chip leaves the page. +To remove a disabled deletable Chip from the tab order, set `skipFocusWhenDisabled`. diff --git a/docs/data/material/getting-started/accessibility/accessibility.md b/docs/data/material/getting-started/accessibility/accessibility.md index ca08a4cef34293..cda42c49f87b94 100644 --- a/docs/data/material/getting-started/accessibility/accessibility.md +++ b/docs/data/material/getting-started/accessibility/accessibility.md @@ -3,7 +3,7 @@

How Material UI components conform to WCAG 2.2 Level A and AA, reported in VPAT terms for procurement and accessibility review.

:::warning -**Draft — partial coverage.** This report covers the 13 components assessed so far, not the whole library. It has not been reviewed by an external auditor, and no assistive-technology testing has been performed yet. See [Scope and limitations](#scope-and-limitations) before relying on it for a procurement decision. +**Draft — partial coverage.** This report covers only the components in the [component table](#conformance-by-component), not the whole library. It has not been reviewed by an external auditor, and no assistive-technology testing has been performed yet. See [Scope and limitations](#scope-and-limitations) before relying on it for a procurement decision. ::: ## About this report @@ -42,6 +42,7 @@ Each row counts only the criteria that **apply** to that component; criteria tha | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md) | 5 | 6 | 11 | 9 | 2 | 6/11 | 2 | | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) | 15 | 12 | 27 | 24 | 3 | 20/27 | 11 | | [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 22/25 | 11 | +| [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | 13 | 11 | 24 | 15 | 9 | 15/24 | 5 | | [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 6/11 | 1 | | [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 6/11 | 1 | | [Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 23/25 | 11 | @@ -57,7 +58,7 @@ Each row counts only the criteria that **apply** to that component; criteria tha **No component records a ❌ Does Not Support rating for any Level A or AA criterion.** -Rolled up to the library level, where each criterion takes the worst rating any assessed component receives, 32 success criteria are exercised: **27 Supports, 5 Partially Supports, 0 Does Not Support.** +Rolled up to the library level, where each criterion takes the worst rating any assessed component receives, 32 success criteria are exercised: **20 Supports, 12 Partially Supports, 0 Does Not Support.** @@ -80,17 +81,21 @@ An application built with Material UI is not automatically accessible. Material ## Known gaps -Five issues account for every ⚠️ rating. Two of them can be fixed through the theme today. +Each ⚠️ rating comes from one of the issues below. Some of them can be fixed through the theme today. -| Gap | Criteria | Affected | Workaround | -| :------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------- | -| **By default, the keyboard focus indicator is the ripple or a background tint, with untested contrast** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [AccordionSummary](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/AccordionSummary/accessibility.md)
[Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
[Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md)
[Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md)
[Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
[ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Enable `focusVisible` in your theme — see below | -| **Some default palette colors fall short of contrast minimums** | [1.4.3 Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
[1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md)
[Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
[CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`warning` with `enableTrackSlot`)
[LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
[Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
[TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md)
[ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Override the affected palette entries | -| **The selected state of colored Toggle Buttons is conveyed almost entirely by hue** | [1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) | [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) (`primary`, `error`, `info`, `success`) | Add a non-color cue to the selected state, such as an icon | -| **Dynamic state changes are not announced** | [4.1.3 Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
[CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md)
[LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
[TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md) (error) | Render your own `aria-live` region alongside | -| **Indefinite animation cannot be paused** | [2.2.2 Pause, Stop, Hide](https://www.w3.org/WAI/WCAG22/Understanding/pause-stop-hide.html) | [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`indeterminate`)
[LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) (`indeterminate`, `query`, `buffer`) | Show it only while an operation is in flight | +| Gap | Criteria | Affected | Workaround | +| :-------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | +| **By default, the keyboard focus indicator is the ripple or a background tint, and its contrast can fall below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [AccordionSummary](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/AccordionSummary/accessibility.md)
[Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
[Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md)
[Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md)
[Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md)
[Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
[ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Enable `focusVisible` in your theme — see below | +| **Some default palette colors fall short of contrast minimums** | [1.4.3 Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
[1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md)
[Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
[Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`info`, `warning`, letter avatar)
[CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`warning` with `enableTrackSlot`)
[LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
[Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
[TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md)
[ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Override the affected palette entries | +| **The selected state of colored Toggle Buttons is conveyed almost entirely by hue** | [1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) | [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) (`primary`, `error`, `info`, `success`) | Add a non-color cue to the selected state, such as an icon | +| **A Chip label does not wrap, so a long label ends with an ellipsis and hides text** | [1.4.4 Resize Text](https://www.w3.org/WAI/WCAG22/Understanding/resize-text.html)
[1.4.10 Reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html)
[1.4.12 Text Spacing](https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | Let the label wrap with `height: 'auto'` and `whiteSpace: 'normal'`, as in the multiline demo | +| **A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and deletable** | [1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html)
[4.1.2 Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`) | Describe the delete key with `aria-describedby`, and set `skipFocusWhenDisabled` on disabled chips | +| **Deleting a Chip with the keyboard moves focus to the page** | [2.4.3 Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`) | Move focus to the next chip, or to the input, in the `onDelete` handler | +| **The Chip delete icon is smaller than 24 by 24 CSS px, and its contrast is below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html)
[2.5.8 Target Size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (16 px `small`, 22 px `medium`) | Enlarge the icon, and give it a darker color, with `sx` on `.MuiChip-deleteIcon` | +| **Dynamic state changes are not announced** | [4.1.3 Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
[CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md)
[LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
[TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md) (error) | Render your own `aria-live` region alongside | +| **Indefinite animation cannot be paused** | [2.2.2 Pause, Stop, Hide](https://www.w3.org/WAI/WCAG22/Understanding/pause-stop-hide.html) | [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`indeterminate`)
[LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) (`indeterminate`, `query`, `buffer`) | Show it only while an operation is in flight | @@ -106,7 +111,7 @@ const theme = createTheme({ focusVisible: true }); Read this section before citing the report. ::: -- **Component coverage is partial.** 13 components are assessed. Widely used components including Select, Autocomplete, Dialog, Menu, Table, Tabs, Slider, Tooltip, Snackbar, and Drawer are **not yet assessed**, and this report says nothing about them. +- **Component coverage is partial.** Only the components in the [component table](#conformance-by-component) are assessed. Widely used components including Select, Autocomplete, Dialog, Menu, Table, Tabs, Slider, Tooltip, Snackbar, and Drawer are **not yet assessed**, and this report says nothing about them. - **No assistive-technology testing.** No screen-reader passes have been performed. Criteria that depend on how a specific assistive technology behaves are assessed from the exposed accessibility tree, not from observed behavior. - **Level AAA is out of scope**, as it is for a standard VPAT. - **Components are rated in isolation**, as rendered with default props and the default theme. Customization, composition, and your surrounding page can change the result. diff --git a/docs/data/material/getting-started/accessibility/knownGaps.json b/docs/data/material/getting-started/accessibility/knownGaps.json index 6062cc623e1f74..c24d0dc0db592a 100644 --- a/docs/data/material/getting-started/accessibility/knownGaps.json +++ b/docs/data/material/getting-started/accessibility/knownGaps.json @@ -1,8 +1,16 @@ [ { - "gap": "By default, the keyboard focus indicator is the ripple or a background tint, with untested contrast", + "gap": "By default, the keyboard focus indicator is the ripple or a background tint, and its contrast can fall below 3:1", "criteria": ["1.4.11"], - "affected": ["AccordionSummary", "Button", "Checkbox", "Radio", "Switch", "ToggleButton"], + "affected": [ + "AccordionSummary", + "Button", + "Checkbox", + "Chip", + "Radio", + "Switch", + "ToggleButton" + ], "workaround": "Enable `focusVisible` in your theme — see below" }, { @@ -11,6 +19,7 @@ "affected": [ "Avatar", "Button", + { "component": "Chip", "note": "`info`, `warning`, letter avatar" }, { "component": "CircularProgress", "note": "`warning` with `enableTrackSlot`" }, "LinearProgress", "Switch", @@ -25,6 +34,30 @@ "affected": [{ "component": "ToggleButton", "note": "`primary`, `error`, `info`, `success`" }], "workaround": "Add a non-color cue to the selected state, such as an icon" }, + { + "gap": "A Chip label does not wrap, so a long label ends with an ellipsis and hides text", + "criteria": ["1.4.4", "1.4.10", "1.4.12"], + "affected": ["Chip"], + "workaround": "Let the label wrap with `height: 'auto'` and `whiteSpace: 'normal'`, as in the multiline demo" + }, + { + "gap": "A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and deletable", + "criteria": ["1.1.1", "4.1.2"], + "affected": [{ "component": "Chip", "note": "`onDelete`" }], + "workaround": "Describe the delete key with `aria-describedby`, and set `skipFocusWhenDisabled` on disabled chips" + }, + { + "gap": "Deleting a Chip with the keyboard moves focus to the page", + "criteria": ["2.4.3"], + "affected": [{ "component": "Chip", "note": "`onDelete`" }], + "workaround": "Move focus to the next chip, or to the input, in the `onDelete` handler" + }, + { + "gap": "The Chip delete icon is smaller than 24 by 24 CSS px, and its contrast is below 3:1", + "criteria": ["1.4.11", "2.5.8"], + "affected": [{ "component": "Chip", "note": "16 px `small`, 22 px `medium`" }], + "workaround": "Enlarge the icon, and give it a darker color, with `sx` on `.MuiChip-deleteIcon`" + }, { "gap": "Dynamic state changes are not announced", "criteria": ["4.1.3"], diff --git a/docs/data/material/getting-started/accessibility/scorecard.json b/docs/data/material/getting-started/accessibility/scorecard.json index 5602791ebcc2b5..67c9c2f5cd643c 100644 --- a/docs/data/material/getting-started/accessibility/scorecard.json +++ b/docs/data/material/getting-started/accessibility/scorecard.json @@ -1,21 +1,21 @@ { "standard": "WCAG 2.2 Level A and AA", - "componentCount": 13, + "componentCount": 14, "totals": { "rated": 32, - "supports": 27, - "partiallySupports": 5, + "supports": 20, + "partiallySupports": 12, "doesNotSupport": 0, - "flagged": 13 + "flagged": 16 }, "criteria": [ { "number": "1.1.1", "name": "Non-text Content", "level": "A", - "conformance": "Supports", - "flagged": false, - "affected": [] + "conformance": "Partially Supports", + "flagged": true, + "affected": ["Chip"] }, { "number": "1.3.1", @@ -63,15 +63,15 @@ "level": "AA", "conformance": "Partially Supports", "flagged": true, - "affected": ["Avatar", "Button", "TextField", "ToggleButton"] + "affected": ["Avatar", "Button", "Chip", "TextField", "ToggleButton"] }, { "number": "1.4.4", "name": "Resize Text", "level": "AA", - "conformance": "Supports", + "conformance": "Partially Supports", "flagged": true, - "affected": [] + "affected": ["Chip"] }, { "number": "1.4.5", @@ -85,9 +85,9 @@ "number": "1.4.10", "name": "Reflow", "level": "AA", - "conformance": "Supports", + "conformance": "Partially Supports", "flagged": false, - "affected": [] + "affected": ["Chip"] }, { "number": "1.4.11", @@ -100,6 +100,7 @@ "Avatar", "Button", "Checkbox", + "Chip", "CircularProgress", "LinearProgress", "Radio", @@ -112,9 +113,9 @@ "number": "1.4.12", "name": "Text Spacing", "level": "AA", - "conformance": "Supports", + "conformance": "Partially Supports", "flagged": false, - "affected": [] + "affected": ["Chip"] }, { "number": "2.1.1", @@ -152,9 +153,9 @@ "number": "2.4.3", "name": "Focus Order", "level": "A", - "conformance": "Supports", - "flagged": false, - "affected": [] + "conformance": "Partially Supports", + "flagged": true, + "affected": ["Chip"] }, { "number": "2.4.4", @@ -208,9 +209,9 @@ "number": "2.5.8", "name": "Target Size (Minimum)", "level": "AA", - "conformance": "Supports", - "flagged": false, - "affected": [] + "conformance": "Partially Supports", + "flagged": true, + "affected": ["Chip"] }, { "number": "3.2.1", @@ -264,9 +265,9 @@ "number": "4.1.2", "name": "Name, Role, Value", "level": "A", - "conformance": "Supports", + "conformance": "Partially Supports", "flagged": false, - "affected": [] + "affected": ["Chip"] }, { "number": "4.1.3", @@ -1399,6 +1400,292 @@ "automated": 11 } }, + { + "component": "Chip", + "counts": { + "supports": 15, + "partiallySupports": 9, + "doesNotSupport": 0, + "notApplicable": 31, + "flagged": 9, + "rated": 24 + }, + "gaps": [ + { + "number": "1.1.1", + "name": "Non-text Content", + "conformance": "Partially Supports" + }, + { + "number": "1.4.3", + "name": "Contrast (Minimum)", + "conformance": "Partially Supports" + }, + { + "number": "1.4.4", + "name": "Resize Text", + "conformance": "Partially Supports" + }, + { + "number": "1.4.10", + "name": "Reflow", + "conformance": "Partially Supports" + }, + { + "number": "1.4.11", + "name": "Non-text Contrast", + "conformance": "Partially Supports" + }, + { + "number": "1.4.12", + "name": "Text Spacing", + "conformance": "Partially Supports" + }, + { + "number": "2.4.3", + "name": "Focus Order", + "conformance": "Partially Supports" + }, + { + "number": "2.5.8", + "name": "Target Size (Minimum)", + "conformance": "Partially Supports" + }, + { + "number": "4.1.2", + "name": "Name, Role, Value", + "conformance": "Partially Supports" + } + ], + "criteria": [ + { + "number": "1.1.1", + "name": "Non-text Content", + "level": "A", + "conformance": "Partially Supports", + "responsibility": "Component", + "group": "Hybrid", + "flagged": true + }, + { + "number": "1.3.1", + "name": "Info and Relationships", + "level": "A", + "conformance": "Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": false + }, + { + "number": "1.3.2", + "name": "Meaningful Sequence", + "level": "A", + "conformance": "Supports", + "responsibility": "Author", + "group": "Manual", + "flagged": true + }, + { + "number": "1.3.3", + "name": "Sensory Characteristics", + "level": "A", + "conformance": "Supports", + "responsibility": "Author", + "group": "Manual", + "flagged": true + }, + { + "number": "1.4.1", + "name": "Use of Color", + "level": "A", + "conformance": "Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": true + }, + { + "number": "1.4.3", + "name": "Contrast (Minimum)", + "level": "AA", + "conformance": "Partially Supports", + "responsibility": "Component", + "group": "Hybrid", + "flagged": false + }, + { + "number": "1.4.4", + "name": "Resize Text", + "level": "AA", + "conformance": "Partially Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": false + }, + { + "number": "1.4.5", + "name": "Images of Text", + "level": "AA", + "conformance": "Supports", + "responsibility": "Author", + "group": "Manual", + "flagged": false + }, + { + "number": "1.4.10", + "name": "Reflow", + "level": "AA", + "conformance": "Partially Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": false + }, + { + "number": "1.4.11", + "name": "Non-text Contrast", + "level": "AA", + "conformance": "Partially Supports", + "responsibility": "Component", + "group": "Hybrid", + "flagged": true + }, + { + "number": "1.4.12", + "name": "Text Spacing", + "level": "AA", + "conformance": "Partially Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": false + }, + { + "number": "2.1.1", + "name": "Keyboard", + "level": "A", + "conformance": "Supports", + "responsibility": "Component", + "group": "Automated", + "flagged": false + }, + { + "number": "2.1.2", + "name": "No Keyboard Trap", + "level": "A", + "conformance": "Supports", + "responsibility": "Component", + "group": "Automated", + "flagged": false + }, + { + "number": "2.4.3", + "name": "Focus Order", + "level": "A", + "conformance": "Partially Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": true + }, + { + "number": "2.4.4", + "name": "Link Purpose (In Context)", + "level": "A", + "conformance": "Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": false + }, + { + "number": "2.4.6", + "name": "Headings and Labels", + "level": "AA", + "conformance": "Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": false + }, + { + "number": "2.4.7", + "name": "Focus Visible", + "level": "AA", + "conformance": "Supports", + "responsibility": "Shared", + "group": "Hybrid", + "flagged": false + }, + { + "number": "2.4.11", + "name": "Focus Not Obscured (Minimum)", + "level": "AA", + "conformance": "Supports", + "responsibility": "Author", + "group": "Manual", + "flagged": true + }, + { + "number": "2.5.2", + "name": "Pointer Cancellation", + "level": "A", + "conformance": "Supports", + "responsibility": "Component", + "group": "Automated", + "flagged": false + }, + { + "number": "2.5.3", + "name": "Label in Name", + "level": "A", + "conformance": "Supports", + "responsibility": "Shared", + "group": "Automated", + "flagged": false + }, + { + "number": "2.5.8", + "name": "Target Size (Minimum)", + "level": "AA", + "conformance": "Partially Supports", + "responsibility": "Component", + "group": "Hybrid", + "flagged": true + }, + { + "number": "3.2.1", + "name": "On Focus", + "level": "A", + "conformance": "Supports", + "responsibility": "Component", + "group": "Automated", + "flagged": false + }, + { + "number": "3.2.4", + "name": "Consistent Identification", + "level": "AA", + "conformance": "Supports", + "responsibility": "Author", + "group": "Manual", + "flagged": true + }, + { + "number": "4.1.2", + "name": "Name, Role, Value", + "level": "A", + "conformance": "Partially Supports", + "responsibility": "Component", + "group": "Hybrid", + "flagged": false + } + ], + "summary": { + "rated": 24, + "levelA": 13, + "levelAA": 11, + "supports": 15, + "partiallySupports": 9, + "doesNotSupport": 0, + "verified": 15, + "automated": 5 + } + }, { "component": "CircularProgress", "counts": { diff --git a/packages/mui-material/src/Chip/Chip.test.js b/packages/mui-material/src/Chip/Chip.test.js index f426e1e79437e2..66a881def61653 100644 --- a/packages/mui-material/src/Chip/Chip.test.js +++ b/packages/mui-material/src/Chip/Chip.test.js @@ -17,6 +17,8 @@ import { ThemeProvider, createTheme, hexToRgb } from '@mui/material/styles'; import CheckBox from '../internal/svg-icons/CheckBox'; import defaultTheme from '../styles/defaultTheme'; import describeConformance from '../../test/describeConformance'; +import { blend, contrastRatio, WCAG_MINIMUM_RATIO, WCAG_NON_TEXT_RATIO } from '../../test/contrast'; +import { FAILING_PALETTE_COLORS, PALETTE_CONTRAST_COLORS } from '../../test/contrastContract'; describe('', () => { const { render } = createRenderer(); @@ -835,4 +837,239 @@ describe('', () => { fireEvent.keyUp(chip, { key: ' ' }); }).not.throw(); }); + + describe('WCAG 2.2 conformance', () => { + describe('1.1.1 Non-text Content', () => { + it('hides the delete icon from assistive technology', () => { + render( {}} />); + + const button = screen.getByRole('button', { name: 'Design' }); + const deleteIcon = button.querySelector(`.${classes.deleteIcon}`); + expect(deleteIcon).to.have.attribute('aria-hidden', 'true'); + }); + }); + + describe('1.4.3 Contrast (Minimum)', () => { + const theme = createTheme(); + + /** The palette colors whose label falls short of 4.5:1 for a variant. */ + function failingColors(variant, background) { + render( + + {PALETTE_CONTRAST_COLORS.map((color) => ( + + ))} + , + ); + return PALETTE_CONTRAST_COLORS.filter((color) => { + const chip = screen.getByText(color).parentElement; + const { color: textColor, backgroundColor } = window.getComputedStyle(chip); + const fill = backgroundColor === 'rgba(0, 0, 0, 0)' ? background : backgroundColor; + return contrastRatio(textColor, fill) < WCAG_MINIMUM_RATIO.normalText; + }); + } + + it('filled labels fall short of 4.5:1 only in the documented palette colors', () => { + expect(failingColors('filled', theme.palette.background.paper)).to.deep.equal([ + ...FAILING_PALETTE_COLORS, + ]); + }); + + it('outlined labels fall short of 4.5:1 only in the documented palette colors', () => { + expect(failingColors('outlined', theme.palette.background.paper)).to.deep.equal([ + ...FAILING_PALETTE_COLORS, + ]); + }); + }); + + it('1.4.11 Non-text Contrast: the default delete icon falls short of 3:1 (documented gap)', () => { + render( {}} />); + + const chip = screen.getByRole('button', { name: 'Design' }); + const deleteIcon = chip.querySelector(`.${classes.deleteIcon}`); + // The default fill is translucent, so composite it over the paper background. + const fill = blend( + window.getComputedStyle(chip).backgroundColor, + 1, + createTheme().palette.background.paper, + ); + const ratio = contrastRatio(window.getComputedStyle(deleteIcon).color, fill); + // When this fails, the icon reaches 3:1: update Chip/accessibility.md and knownGaps.json. + expect(ratio).to.be.below(WCAG_NON_TEXT_RATIO); + }); + + describe('2.1.1 Keyboard', () => { + it('activates a clickable chip with Enter and Space', async () => { + const handleClick = spy(); + const { user } = render(); + + await user.tab(); + await user.keyboard('{Enter}'); + await user.keyboard(' '); + expect(handleClick.callCount).to.equal(2); + }); + + it('deletes a deletable chip with Backspace and Delete', async () => { + const handleDelete = spy(); + const { user } = render(); + + await user.tab(); + await user.keyboard('{Backspace}'); + await user.keyboard('{Delete}'); + expect(handleDelete.callCount).to.equal(2); + }); + }); + + it('2.1.2 No Keyboard Trap: keyboard focus can enter and leave the chip', async () => { + const { user } = render( + + + {}} onDelete={() => {}} /> + + , + ); + + await user.tab(); + await user.tab(); + expect(screen.getByRole('button', { name: 'Middle' })).toHaveFocus(); + + await user.tab(); + expect(screen.getByRole('button', { name: 'After' })).toHaveFocus(); + + await user.tab({ shift: true }); + await user.tab({ shift: true }); + expect(screen.getByRole('button', { name: 'Before' })).toHaveFocus(); + }); + + describe('2.4.3 Focus Order', () => { + it('keeps a static chip out of the tab order', async () => { + const { user } = render( + + + + , + ); + + await user.tab(); + expect(screen.getByRole('button', { name: 'After' })).toHaveFocus(); + }); + + it('makes clickable and deletable chips tab stops in DOM order', async () => { + const { user } = render( + + {}} /> + {}} /> + , + ); + + await user.tab(); + expect(screen.getByRole('button', { name: 'Clickable' })).toHaveFocus(); + await user.tab(); + expect(screen.getByRole('button', { name: 'Deletable' })).toHaveFocus(); + }); + + it('removes a disabled clickable chip from the tab order', async () => { + const { user } = render( + + {}} disabled /> + + , + ); + + await user.tab(); + expect(screen.getByRole('button', { name: 'After' })).toHaveFocus(); + }); + }); + + it('2.5.2 Pointer Cancellation: activates on click, but not when released off the target', async () => { + const handleClick = spy(); + const { user } = render( + + +
+ , + ); + const chip = screen.getByRole('button', { name: 'Filter' }); + + await user.pointer([ + { keys: '[MouseLeft>]', target: chip }, + { target: screen.getByTestId('outside') }, + { keys: '[/MouseLeft]' }, + ]); + expect(handleClick.callCount).to.equal(0); + + await user.click(chip); + expect(handleClick.callCount).to.equal(1); + }); + + it('2.5.3 Label in Name: the accessible name is the visible label', () => { + render( {}} />); + + expect(screen.getByRole('button')).toHaveAccessibleName('Design'); + }); + + it('3.2.1 On Focus: moving keyboard focus to the chip does not activate or delete it', async () => { + const handleClick = spy(); + const handleDelete = spy(); + const { user } = render( + , + ); + + await user.tab(); + expect(screen.getByRole('button')).toHaveFocus(); + expect(handleClick.callCount).to.equal(0); + expect(handleDelete.callCount).to.equal(0); + }); + + describe('4.1.2 Name, Role, Value', () => { + it('gives a static chip no interactive role', () => { + render(); + + expect(screen.queryByRole('button')).to.equal(null); + }); + + it('gives a clickable chip the button role and its label as name', () => { + render( {}} />); + + expect(screen.getByRole('button', { name: 'Filter' })).not.to.equal(null); + }); + + it('gives a link chip the link role', () => { + render(); + + expect(screen.getByRole('link', { name: 'Docs' })).to.have.tagName('a'); + }); + + it('does not expose the disabled state of a disabled delete-only chip (documented gap)', async () => { + const handleDelete = spy(); + const { user } = render(); + const chip = screen.getByRole('button'); + + // When this fails, the gap is fixed: update Chip/accessibility.md and knownGaps.json. + expect(chip).not.to.have.attribute('aria-disabled'); + await user.tab(); + expect(chip).toHaveFocus(); + await user.keyboard('{Backspace}'); + expect(handleDelete.callCount).to.equal(1); + }); + + it('removes a disabled delete-only chip from the tab order with skipFocusWhenDisabled', async () => { + const { user } = render( + + {}} disabled skipFocusWhenDisabled /> + + , + ); + + await user.tab(); + expect(screen.getByRole('button', { name: 'After' })).toHaveFocus(); + }); + + it('exposes the disabled state of a disabled clickable chip', () => { + render( {}} disabled />); + + expect(screen.getByRole('button')).to.have.attribute('aria-disabled', 'true'); + }); + }); + }); }); diff --git a/packages/mui-material/src/Chip/accessibility.json b/packages/mui-material/src/Chip/accessibility.json new file mode 100644 index 00000000000000..cba427b5f4ad78 --- /dev/null +++ b/packages/mui-material/src/Chip/accessibility.json @@ -0,0 +1,54 @@ +{ + "axe": "docs/data/material/components/chips/chips.a11y.json", + "tests": ["ButtonBase"], + "criteria": { + "1.1.1": { + "conformance": "Partially Supports", + "responsibility": "Component", + "flagged": true + }, + "1.3.2": { + "flagged": true + }, + "1.3.3": { + "flagged": true + }, + "1.4.3": { + "responsibility": "Component" + }, + "1.4.4": { + "conformance": "Partially Supports", + "group": "Hybrid" + }, + "1.4.10": { + "conformance": "Partially Supports", + "group": "Hybrid" + }, + "1.4.12": { + "conformance": "Partially Supports", + "group": "Hybrid" + }, + "2.4.3": { + "conformance": "Partially Supports", + "group": "Hybrid", + "flagged": true + }, + "2.4.4": {}, + "2.4.11": { + "flagged": true + }, + "2.5.8": { + "conformance": "Partially Supports", + "group": "Hybrid", + "flagged": true + }, + "3.2.4": { + "flagged": true + }, + "4.1.2": { + "conformance": "Partially Supports", + "responsibility": "Component" + } + }, + "notApplicable": ["3.2.2", "3.3.2"] +} diff --git a/packages/mui-material/src/Chip/accessibility.md b/packages/mui-material/src/Chip/accessibility.md new file mode 100644 index 00000000000000..b03655b4521ebd --- /dev/null +++ b/packages/mui-material/src/Chip/accessibility.md @@ -0,0 +1,539 @@ + + +# Chip accessibility conformance + +Rated against WCAG 2.2 Level A and AA. See the [reports legend](../accessibility.md). + +| Result | Count | +| :-------------------- | :---- | +| ✅ Supports | 15 | +| ⚠️ Partially Supports | 9 | +| ❌ Does Not Support | 0 | +| ➖ Not Applicable | 31 | +| 🚩 Flagged | 9/24 | + +## Known gaps + +- ⚠️ **1.1.1 Non-text Content.** The delete icon tells sighted users that the chip can be deleted. No text gives this information to a screen-reader user. +- ⚠️ **1.4.3 Contrast (Minimum).** `info` and `warning` labels are less than `4.5:1` in the `filled` and `outlined` variants. A letter avatar is `3.30:1`. +- ⚠️ **1.4.4 Resize Text.** The label does not wrap. At a 200% text size, a label that fits at 100% ends with an ellipsis and hides text. +- ⚠️ **1.4.10 Reflow.** The label does not wrap. At 320 CSS px, a label that fits a wide layout ends with an ellipsis. +- ⚠️ **1.4.11 Non-text Contrast.** The default delete icon is `1.86:1` on a `filled` chip and `1.88:1` on an `outlined` chip. The focused background is `1.61:1` against the page. +- ⚠️ **1.4.12 Text Spacing.** The label does not wrap. With the WCAG text-spacing values, a label that fits at default spacing can end with an ellipsis. +- ⚠️ **2.4.3 Focus Order.** The component does not move focus after a deletion. In the ChipsArray demo, a keyboard deletion moves focus to the page body. +- ⚠️ **2.5.8 Target Size (Minimum).** The delete icon is 22 px on a `medium` chip. It is 16 px on a `small` chip. On a clickable and deletable chip, the chip itself is a target, so the spacing exception does not apply. +- ⚠️ **4.1.2 Name, Role, Value.** The component does not set `aria-disabled` on a disabled delete-only chip. The chip stays focusable, and Backspace still deletes it. + +## Success criteria + +### 🔍 Manual + +#### 1.3.2 Meaningful Sequence · A + +`🚩` · `✅ Supports` · `○ Author` + + + +- A chip renders its avatar or icon, its label, and its delete icon in DOM order. + +**Manual testing steps** + +1. Press Tab through a set of chips. +2. Compare the focus order with the visual order. + + + +**Pass:** the focus order matches the visual order. + +#### 1.3.3 Sensory Characteristics · A + +`🚩` · `✅ Supports` · `○ Author` + + + +- A chip has a visible label, so users identify it by its text. + +**Manual testing steps** + +1. Find product copy that refers to a chip. +2. Make sure that it names the chip label, not only its color or position. + + + +**Pass:** no instruction refers to a chip by color or position alone. + +#### 1.4.5 Images of Text · AA + +`✅ Supports` · `○ Author` + + + +- The label is real text. + +**Manual testing steps** + +1. Select the text of a chip label with the mouse. + + + +**Pass:** the label is real text. + +#### 2.4.11 Focus Not Obscured (Minimum) · AA + +`🚩` · `✅ Supports` · `○ Author` + + + +- A chip is an ordinary focusable element and does not put itself behind other content. + +**Manual testing steps** + +1. In a page with a sticky header, press Tab to a chip near it. +2. Scroll so that the chip is under the header. +3. Press Shift+Tab. +4. Press Tab to move focus back to the chip. + + + +**Pass:** a part of the focused chip stays visible. + +#### 3.2.4 Consistent Identification · AA + +`🚩` · `✅ Supports` · `○ Author` + + + +- The name comes from the label. Consistency across pages is an authoring concern. + +**Manual testing steps** + +1. List the chips that do the same job across the product. +2. Compare their labels and icons. + + + +**Pass:** the same job uses the same label and icon. + +### 🔁 Hybrid + +#### 1.1.1 Non-text Content · A + +`🚩` · `⚠️ Partially Supports` · `● Component` + +Tested by: unit `Chip.test.js` + + + +- The default delete icon is an `SvgIcon` with `aria-hidden="true"`, and it is not focusable. A unit test confirms `aria-hidden`. A pointer user clicks it. A keyboard user presses Backspace or Delete on the focused chip. +- The icon tells sighted users that the chip can be deleted. No text gives this information to a screen-reader user. +- A custom `deleteIcon` keeps its own attributes. Use an `SvgIcon`, or set `aria-hidden` on it. +- An `icon` is hidden. An `avatar` is not hidden, so its letter or its image `alt` becomes part of the name. Set `alt=""` on an image avatar when the label already gives the name. + +**Manual testing steps** + +1. Start a screen reader (NVDA with Chrome, or VoiceOver with Safari). +2. Press Tab to a deletable chip. +3. Listen to the announcement. +4. Write down how a screen-reader user learns that the chip can be deleted. + + + +**Pass:** the screen reader tells the user that the chip can be deleted. Expected result from the source: it does not. To fix it, add a description with `aria-describedby`. + +#### 1.3.1 Info and Relationships · A + +`✅ Supports` · `◐ Shared` + +Tested by: axe-core `list` ✅, `listitem` ✅ + + + +- A static chip is a `
` with no role. A clickable or deletable chip has the button role. A chip with `component="a"` and `href` is a link. Unit tests confirm the roles. +- A set of chips is not marked as a list. If the chips form a list, the author wraps them in `
    ` and `
  • `, as the ChipsArray demo does. + +**Manual testing steps** + +1. With a screen reader, move to a static, a clickable, and a link chip. +2. Listen to the role of each. +3. Move to a set of chips and listen for a list. + + + +**Pass:** each chip announces the correct role, and a list of chips is announced as a list. + +#### 1.4.1 Use of Color · A + +`🚩` · `✅ Supports` · `◐ Shared` + + + +- The label and the icon give the meaning of a chip. The `color` prop only tints it. +- A selected filter chip that differs only by color loses its meaning without color. This is an authoring concern. + +**Manual testing steps** + +1. Set the view to grayscale. In Chrome DevTools, open the Rendering tab, then select Emulate vision deficiencies > Achromatopsia. +2. Make sure that you can identify each chip and its state. + + + +**Pass:** the meaning and the state of each chip stay clear without color. + +#### 1.4.3 Contrast (Minimum) · AA + +`⚠️ Partially Supports` · `● Component` + +Tested by: unit `Chip.test.js` · axe-core `color-contrast` ❌ + + + +- A `filled` chip renders `contrastText` on `main`. An `outlined` chip renders `main` on the page. In both variants, `info` (`3.86:1`) and `warning` (`3.11:1`) are less than `4.5:1`. +- Unit tests compare the results with the [palette contrast contract](../../test/contrastContract.ts). Only these colors fail. axe-core `color-contrast` fails on the color fixture. +- The `default` color is `text.primary` on `action.selected`, about `13.9:1`. +- A letter avatar in a chip renders `grey[700]` on `grey[400]`, `3.30:1`. +- A disabled chip is exempt. But a disabled delete-only chip still deletes on Backspace, so it is not an inactive component, and its faded label (`2.14:1`, measured by axe-core) is a real failure. +- All values are for the light palette. + +**Manual testing steps** + +1. With a contrast checker, measure the label against the chip background, for each color and variant in use. +2. Measure the letter of any letter avatar. + + + +**Pass:** each label is at least `4.5:1`. `info`, `warning`, and the letter avatar fail. + +#### 1.4.4 Resize Text · AA + +`⚠️ Partially Supports` · `◐ Shared` + +Tested by: Playwright + + + +- The label uses `rem`, so it scales with the text size. A Playwright test confirms that the ChipsArray demo, with short labels, does not overflow at a 200% text size. +- The label does not wrap, and it ends with an ellipsis when the chip is too narrow. In the `ChipA11yLongLabel` fixture, a label fits its 240 px container at 100% (177 px). At a 200% text size, 219 px of the 331 px label is visible. A Playwright test confirms this gap. +- Full-page zoom scales the container too, so it does not cause this. Text-only resize does, and the library tests 1.4.4 with text-only resize. +- To fix it, let the label wrap with `height: 'auto'` on the chip, and `display: 'block'` and `whiteSpace: 'normal'` on the label, as the MultilineChips demo does. + +**Manual testing steps** + +1. Render a chip with a label that just fits its container. +2. Set the browser text size to 200%. +3. Make sure that the full label stays visible. + + + +**Pass:** the full label stays visible. A long label fails with the default styles. + +#### 1.4.10 Reflow · AA + +`⚠️ Partially Supports` · `◐ Shared` + +Tested by: Playwright + + + +- A chip is `inline-flex` with `maxWidth: 100%`, and its label does not wrap. At 320 CSS px, a label that fits a wide layout ends with an ellipsis. In the `ChipA11yLongLabel` fixture, 283 px of a 353 px label is visible. A Playwright test confirms this gap. +- A Playwright test confirms that the ChipsArray demo, which wraps its chips, does not scroll at 320 px. In a Playwright run, the ClickableAndDeletableChips demo, a row that does not wrap, scrolled by 6 px. This is a layout concern. + +**Manual testing steps** + +1. Render a chip with a long label at full width. +2. Set the viewport width to 320 CSS px. +3. Make sure that the full label stays visible. + + + +**Pass:** the full label stays visible. A long label fails with the default styles. + +#### 1.4.11 Non-text Contrast · AA + +`🚩` · `⚠️ Partially Supports` · `● Component` + +Tested by: unit `Chip.test.js` + + + +- The delete icon is the only visual sign of the delete control. It is less than `3:1` in most combinations, in the light palette: + - `default` `filled`: `text.primary` at `26%` on `action.selected`, `1.86:1`. + - `default` `outlined`: `1.88:1` against white. + - Palette `filled`: `contrastText` at `70%` on `main`, `2.22:1` (`warning`) to `3.83:1` (`secondary`). + - Palette `outlined`: `main` at `70%`, `2.23:1` to `3.57:1`. +- A unit test confirms that the default delete icon is less than `3:1`. +- On keyboard focus, the chip background gets darker. The focused `default` fill is `1.61:1` against the page. +- The `outlined` border is `grey[400]` (`1.88:1` against white), or `main` at `70%` (`2.23:1` to `3.57:1`). The label identifies the chip, so the border does not need `3:1`. +- With `focusVisible: true` on the theme, keyboard focus draws the theme outline ring instead. A Playwright test confirms the ring. + +**Manual testing steps** + +1. With a contrast checker, measure the delete icon against the chip background. +2. Press Tab to a clickable chip. +3. Measure the focused background against the page. +4. Measure the `outlined` border against the page. + + + +**Pass:** the delete icon and the focus indicator are at least `3:1`. The `outlined` border does not need `3:1`, because the label identifies the chip. It is `1.88:1` (default) and `2.23:1` to `3.57:1` (palette). The default delete icon and focus indicator fail. + +#### 1.4.12 Text Spacing · AA + +`⚠️ Partially Supports` · `◐ Shared` + +Tested by: Playwright · axe-core `avoid-inline-spacing` ✅ + + + +- A Playwright test applies the WCAG text-spacing values to the ChipsArray demo. Its short labels stay visible. +- The spacing values make a label about 25% wider. In the `ChipA11yLongLabel` fixture, a label that fits at default spacing (177 px) needs 224 px, and the chip shows 219 px. A Playwright test confirms this gap. + +**Manual testing steps** + +1. Render a chip with a label that just fits its container. +2. Apply the WCAG text-spacing values, for example with a text-spacing bookmarklet. +3. Make sure that the full label stays visible. + + + +**Pass:** the full label stays visible. A long label fails with the default styles. + +#### 2.4.3 Focus Order · A + +`🚩` · `⚠️ Partially Supports` · `◐ Shared` + +Tested by: unit `Chip.test.js` + + + +- A static chip is not a tab stop. A clickable or deletable chip is one tab stop in DOM order, and a disabled clickable chip leaves the tab order. Unit tests confirm this. +- When a chip is deleted, the author's `onDelete` handler removes it. The component does not move focus. In the ChipsArray demo, a keyboard deletion moves focus to the page body. The author must move focus, for example to the next chip. + +**Manual testing steps** + +1. In the ChipsArray demo, press Tab to a chip. +2. Press Backspace to delete it. +3. Write down which element has focus. + + + +**Pass:** focus moves to a nearby chip or control, not to the top of the page. The ChipsArray demo fails. + +#### 2.4.4 Link Purpose (In Context) · A + +`✅ Supports` · `◐ Shared` + +Tested by: axe-core `link-name` ✅ + + + +- This applies to a chip with `component="a"` and `href`. The label must tell the destination. + +**Manual testing steps** + +1. Find chips that link to another page. +2. Read the label of each, together with the content around it. + + + +**Pass:** the destination of each link chip is clear. + +#### 2.4.6 Headings and Labels · AA + +`✅ Supports` · `◐ Shared` + + + +- The label of a chip is its accessible name. Whether it describes the chip is an authoring concern. + +**Manual testing steps** + +1. Read each chip label out of context. + + + +**Pass:** each label describes the item or the filter. + +#### 2.4.7 Focus Visible · AA + +`✅ Supports` · `◐ Shared` + +Tested by: Playwright + + + +- On keyboard focus, a clickable or deletable chip gets a darker background. A Playwright test confirms that keyboard focus changes how a clickable chip looks. +- The change can be hard to see. For a `filled` `error` chip, the background changes from `#d32f2f` to `#c62828`. See 1.4.11. +- With `focusVisible: true` on the theme, keyboard focus draws the theme outline ring. + +**Manual testing steps** + +1. Press Tab to a clickable chip and to a deletable chip. +2. Make sure that a focus indicator shows on each, for each color in use. + + + +**Pass:** each focused chip shows a visible change. + +#### 2.5.8 Target Size (Minimum) · AA + +`🚩` · `⚠️ Partially Supports` · `● Component` + +Tested by: axe-core `target-size` ✅ + + + +- A `medium` chip is 32 px high, and a `small` chip is 24 px high. axe-core `target-size` confirms the chips on the demos. +- The delete icon is a separate pointer target. It is 22 by 22 px on a `medium` chip, and 16 by 16 px on a `small` chip. axe-core does not check the icon, because it is not focusable. +- On a clickable and deletable chip, the chip itself is a target. A 24 px circle on the icon touches it, so the spacing exception does not apply. The equivalent exception does not apply either, because Backspace is not a pointer target. +- On a delete-only chip, the chip does nothing on click, so the spacing exception can apply. + +**Manual testing steps** + +1. In browser DevTools, select the delete icon of a `size="small"` chip. +2. Read the width and height of its box. + + + +**Pass:** the delete icon is at least 24 by 24 CSS px. Or, a 24 px circle on its center touches no other target. The default icon is 16 by 16 px. + +#### 4.1.2 Name, Role, Value · A + +`⚠️ Partially Supports` · `● Component` + +Tested by: unit `Chip.test.js` · axe-core `aria-allowed-attr` ✅, `aria-command-name` ✅, `aria-conditional-attr` ✅, `aria-deprecated-role` ✅, `aria-hidden-focus` ✅, `aria-prohibited-attr` ✅, `aria-required-attr` ✅, `aria-roles` ✅, `aria-valid-attr` ✅, `aria-valid-attr-value` ✅, `link-name` ✅, `nested-interactive` ✅ + + + +- A clickable chip has the button role, and its label is the name. A disabled clickable chip has `aria-disabled="true"`. Unit tests confirm this. +- The component does not set `aria-disabled` on a disabled delete-only chip. The chip stays focusable, and Backspace still calls `onDelete`. A unit test confirms this gap. +- `skipFocusWhenDisabled` removes a disabled chip from the tab order, which also blocks Backspace. The state is still not exposed. +- A delete-only chip has the button role, but Enter and Space do nothing. + +**Manual testing steps** + +1. Start a screen reader. +2. Press Tab past a static chip. Make sure that focus does not stop on it. +3. Press Tab to a clickable chip, a deletable chip, and a disabled deletable chip. +4. Listen to the name, role, and state of each. +5. On the disabled deletable chip, press Backspace. + + + +**Pass:** each chip announces its label and "button". The disabled chip announces "disabled" and cannot be deleted. The disabled delete-only chip fails. + +### ⚙️ Automated + +#### 2.1.1 Keyboard · A + +`✅ Supports` · `● Component` + +Tested by: unit `Chip.test.js`, `ButtonBase.test.js` + + + +- A clickable chip activates with Enter and Space. A deletable chip calls `onDelete` on the release of Backspace or Delete. Unit tests confirm both. The author's `onDelete` removes the chip. + +**Manual testing steps** + +1. Press Tab to a deletable chip in the ChipsArray demo. +2. Press Backspace or Delete. +3. Press Tab to a clickable chip. +4. Press Enter, then Space. + + + +**Pass:** the deletable chip is removed, and the clickable chip activates on each key. + +#### 2.1.2 No Keyboard Trap · A + +`✅ Supports` · `● Component` + +Tested by: unit `Chip.test.js` + + + +- The chip is one focusable element and does not capture focus. A unit test confirms that Tab and Shift+Tab move focus in and out. + + + +#### 2.5.2 Pointer Cancellation · A + +`✅ Supports` · `● Component` + +Tested by: unit `Chip.test.js` + + + +- Activation runs on `click`, on the pointer up-event. A unit test confirms that a release off the chip cancels the activation. + + + +#### 2.5.3 Label in Name · A + +`✅ Supports` · `◐ Shared` + +Tested by: unit `Chip.test.js` + + + +- The label is the accessible name. A unit test confirms this. + + + +#### 3.2.1 On Focus · A + +`✅ Supports` · `● Component` + +Tested by: unit `Chip.test.js` + + + +- Focus only changes the background. A unit test confirms that focus does not activate or delete the chip. + + + +## Not applicable + +- **1.2.1 Audio-only and Video-only (Prerecorded) (A), 1.2.2 Captions (Prerecorded) (A), 1.2.3 Audio Description or Media Alternative (Prerecorded) (A), 1.2.4 Captions (Live) (AA), 1.2.5 Audio Description (Prerecorded) (AA).** No audio or video. +- **1.3.4 Orientation (AA).** Sets no orientation lock; a layout concern. +- **1.3.5 Identify Input Purpose (AA).** Collects no information about the user through `autocomplete`. +- **1.4.2 Audio Control (A).** Emits no audio. +- **1.4.13 Content on Hover or Focus (AA).** Shows no additional content on hover or focus; a `Tooltip` wrapper would own this. +- **2.1.4 Character Key Shortcuts (A).** Binds no single-character keyboard shortcut. +- **2.2.1 Timing Adjustable (A).** Sets no time limit. +- **2.2.2 Pause, Stop, Hide (A).** No auto-starting moving, blinking, or auto-updating content. +- **2.3.1 Three Flashes or Below Threshold (A).** Nothing flashes. +- **2.4.1 Bypass Blocks (A), 2.4.2 Page Titled (A), 2.4.5 Multiple Ways (AA).** Page or site structure, not a single component. +- **2.5.1 Pointer Gestures (A), 2.5.4 Motion Actuation (A).** Activates on a simple click; reads no device motion. +- **2.5.7 Dragging Movements (AA).** No drag interactions. +- **3.1.1 Language of Page (A), 3.1.2 Language of Parts (AA).** The component emits no `` and no text of its own. A foreign-language label is the author's phrase to mark. +- **3.2.2 On Input (A).** A chip has no setting that the user changes. Deletion is an explicit action. +- **3.2.3 Consistent Navigation (AA).** Covers repeated navigation across a set of pages, not a single component. +- **3.2.6 Consistent Help (A).** Covers consistent placement of help across pages. +- **3.3.1 Error Identification (A), 3.3.3 Error Suggestion (AA), 3.3.4 Error Prevention (Legal, Financial, Data) (AA).** Collects and validates no input; these belong to the form or process. +- **3.3.2 Labels or Instructions (A).** A chip is not a form field. +- **3.3.7 Redundant Entry (A).** Captures no previously entered data to repopulate. +- **3.3.8 Accessible Authentication (Minimum) (AA).** No authentication step; the duty falls on the credential fields. +- **4.1.3 Status Messages (AA).** Emits no status messages; state changes are covered by 4.1.2. + +## Level AAA + + + +- **2.5.5 Target Size (Enhanced), 44 px.** Chips are 24 or 32 px high, and the delete icon is 16 or 22 px. `🚩` +- **2.4.13 Focus Appearance.** The focused background differs from the resting background by `1.13:1` to `1.92:1`, which does not meet it. `🚩` + + + +## Scope and test environment + +- **Standard.** WCAG 2.2, Level A and AA. +- **Component version.** `@mui/material` 10.0.0-alpha.0. + + + +- **Scope.** The Chip component in isolation, rendered through its documented API. +- **Automated.** axe-core in the Playwright test harness, on the Chip demos and fixtures in [`chips.a11y.json`](../../../../docs/data/material/components/chips/chips.a11y.json). Interaction and contrast tests are in `Chip.test.js` and `ButtonBase.test.js`. +- **Assistive-technology review.** Not done yet. The flagged criteria come from a review of the source. A review with NVDA, JAWS, and VoiceOver must still confirm them. + + diff --git a/packages/mui-material/src/accessibility.md b/packages/mui-material/src/accessibility.md index ccd0a626c6386c..02615438a9a773 100644 --- a/packages/mui-material/src/accessibility.md +++ b/packages/mui-material/src/accessibility.md @@ -188,6 +188,7 @@ Edit the JSON files, not this table. | [Avatar](./Avatar/accessibility.md) | 9 | 2 | 0 | 44 | — | 5/11 | | [Button](./Button/accessibility.md) | 24 | 3 | 0 | 28 | — | 7/27 | | [Checkbox](./Checkbox/accessibility.md) | 24 | 1 | 0 | 30 | — | 3/25 | +| [Chip](./Chip/accessibility.md) | 15 | 9 | 0 | 31 | — | 9/24 | | [CircularProgress](./CircularProgress/accessibility.md) | 8 | 3 | 0 | 44 | — | 5/11 | | [LinearProgress](./LinearProgress/accessibility.md) | 8 | 3 | 0 | 44 | — | 5/11 | | [Radio](./Radio/accessibility.md) | 24 | 1 | 0 | 30 | — | 2/25 | diff --git a/packages/mui-material/src/manual-testing.md b/packages/mui-material/src/manual-testing.md index 4a34f0df831d0a..1ed4f25e98ddb8 100644 --- a/packages/mui-material/src/manual-testing.md +++ b/packages/mui-material/src/manual-testing.md @@ -18,14 +18,14 @@ the component (○ Author). Run the rows matching what you touched, for the component you touched. -| If your change touches… | Re-check | -| :----------------------------------- | :------------------------------------------------------------------------------------------------------------------------------ | -| Styling, theme, or palette | 1.4.1 Use of Color; 1.4.3 Contrast (Minimum); 1.4.4 Resize Text; 1.4.5 Images of Text; 1.4.11 Non-text Contrast | -| DOM structure, roles, or ARIA | 1.1.1 Non-text Content; 1.3.1 Info and Relationships; 1.3.2 Meaningful Sequence; 4.1.2 Name, Role, Value; 4.1.3 Status Messages | -| Keyboard, focus, or pointer handling | 2.4.4 Link Purpose (In Context); 2.4.6 Headings and Labels; 2.4.7 Focus Visible | -| Labels, errors, or validation | 3.3.2 Labels or Instructions | -| Motion or timing | 2.2.2 Pause, Stop, Hide | -| Other | 2.3.1 Three Flashes or Below Threshold | +| If your change touches… | Re-check | +| :----------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | +| Styling, theme, or palette | 1.4.1 Use of Color; 1.4.3 Contrast (Minimum); 1.4.4 Resize Text; 1.4.5 Images of Text; 1.4.10 Reflow; 1.4.11 Non-text Contrast; 1.4.12 Text Spacing | +| DOM structure, roles, or ARIA | 1.1.1 Non-text Content; 1.3.1 Info and Relationships; 1.3.2 Meaningful Sequence; 4.1.2 Name, Role, Value; 4.1.3 Status Messages | +| Keyboard, focus, or pointer handling | 2.4.3 Focus Order; 2.4.4 Link Purpose (In Context); 2.4.6 Headings and Labels; 2.4.7 Focus Visible; 2.5.8 Target Size (Minimum) | +| Labels, errors, or validation | 3.3.2 Labels or Instructions | +| Motion or timing | 2.2.2 Pause, Stop, Hide | +| Other | 2.3.1 Three Flashes or Below Threshold | ## Accordion @@ -93,6 +93,25 @@ Run the rows matching what you touched, for the component you touched. - [ ] 🔁 **3.3.2 Labels or Instructions** — every checkbox has a label or instruction presented to all users, via `FormControlLabel`, adjacent text, or clear context. - [ ] 🔁 **4.1.2 Name, Role, Value** — the role, the checked/unchecked/mixed/disabled state with change notification, and an author-supplied accessible name are all programmatically determinable. +## Chip + +14 checks · full procedures in [`Chip/accessibility.md`](./Chip/accessibility.md) + +- [ ] 🔁 **1.1.1 Non-text Content** — the screen reader tells the user that the chip can be deleted. Expected result from the source: it does not. To fix it, add a description with `aria-describedby`. +- [ ] 🔁 **1.3.1 Info and Relationships** — each chip announces the correct role, and a list of chips is announced as a list. +- [ ] 🔁 **1.4.1 Use of Color** — the meaning and the state of each chip stay clear without color. +- [ ] 🔁 **1.4.3 Contrast (Minimum)** — each label is at least `4.5:1`. `info`, `warning`, and the letter avatar fail. +- [ ] 🔁 **1.4.4 Resize Text** — the full label stays visible. A long label fails with the default styles. +- [ ] 🔁 **1.4.10 Reflow** — the full label stays visible. A long label fails with the default styles. +- [ ] 🔁 **1.4.11 Non-text Contrast** — the delete icon and the focus indicator are at least `3:1`. The `outlined` border does not need `3:1`, because the label identifies the chip. It is `1.88:1` (default) and `2.23:1` to `3.57:1` (palette). The default delete icon and focus indicator fail. +- [ ] 🔁 **1.4.12 Text Spacing** — the full label stays visible. A long label fails with the default styles. +- [ ] 🔁 **2.4.3 Focus Order** — focus moves to a nearby chip or control, not to the top of the page. The ChipsArray demo fails. +- [ ] 🔁 **2.4.4 Link Purpose (In Context)** — the destination of each link chip is clear. +- [ ] 🔁 **2.4.6 Headings and Labels** — each label describes the item or the filter. +- [ ] 🔁 **2.4.7 Focus Visible** — each focused chip shows a visible change. +- [ ] 🔁 **2.5.8 Target Size (Minimum)** — the delete icon is at least 24 by 24 CSS px. Or, a 24 px circle on its center touches no other target. The default icon is 16 by 16 px. +- [ ] 🔁 **4.1.2 Name, Role, Value** — each chip announces its label and "button". The disabled chip announces "disabled" and cannot be deleted. The disabled delete-only chip fails. + ## CircularProgress 8 checks · full procedures in [`CircularProgress/accessibility.md`](./CircularProgress/accessibility.md) diff --git a/packages/mui-material/test/contrast.ts b/packages/mui-material/test/contrast.ts index ca0ba769a7f42c..5cfb4486a5d2ac 100644 --- a/packages/mui-material/test/contrast.ts +++ b/packages/mui-material/test/contrast.ts @@ -136,6 +136,9 @@ export const WCAG_MINIMUM_RATIO = { largeText: 3, } as const; +/** The 1.4.11 Non-text Contrast threshold for graphical objects and component boundaries. */ +export const WCAG_NON_TEXT_RATIO = 3; + /** CSS keywords `fontWeight` accepts that map to a fixed numeric weight. */ const ABSOLUTE_FONT_WEIGHTS: Record = { normal: 400, bold: 700 }; diff --git a/test/regressions/a11y/criteriaSuites.mjs b/test/regressions/a11y/criteriaSuites.mjs index c8fcde0fe3808c..32f9147d7367b0 100644 --- a/test/regressions/a11y/criteriaSuites.mjs +++ b/test/regressions/a11y/criteriaSuites.mjs @@ -22,6 +22,7 @@ export const CSS_LAYOUT_SUITES = [ }, { component: 'Button', route: '/docs-components-buttons/BasicButtons' }, { component: 'Checkbox', route: '/docs-components-checkboxes/Checkboxes' }, + { component: 'Chip', route: '/docs-components-chips/ChipsArray' }, { component: 'CircularProgress', route: '/docs-components-progress/CircularDeterminate', @@ -64,6 +65,11 @@ export const FOCUS_VISIBLE_TARGETS = [ route: '/docs-components-checkboxes/Checkboxes', selector: '.MuiCheckbox-root', }, + { + component: 'Chip', + route: '/docs-components-chips/ClickableChips', + selector: '.MuiChip-clickable', + }, { component: 'Radio', route: '/docs-components-radio-buttons/RadioButtonsGroup', diff --git a/test/regressions/a11y/fixtures/chips/ChipA11yColorMatrix.js b/test/regressions/a11y/fixtures/chips/ChipA11yColorMatrix.js new file mode 100644 index 00000000000000..6b1ed6ca3247c7 --- /dev/null +++ b/test/regressions/a11y/fixtures/chips/ChipA11yColorMatrix.js @@ -0,0 +1,19 @@ +import Box from '@mui/material/Box'; +import Chip from '@mui/material/Chip'; + +const variants = ['filled', 'outlined']; +const colors = ['default', 'primary', 'secondary', 'success', 'error', 'info', 'warning']; + +export default function ChipA11yColorMatrix() { + return ( + div': { display: 'flex', flexWrap: 'wrap', gap: 1 } }}> + {variants.map((variant) => ( +
    + {colors.map((color) => ( + + ))} +
    + ))} +
    + ); +} diff --git a/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js b/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js new file mode 100644 index 00000000000000..0568ec754de636 --- /dev/null +++ b/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js @@ -0,0 +1,16 @@ +import Stack from '@mui/material/Stack'; +import Chip from '@mui/material/Chip'; +import Avatar from '@mui/material/Avatar'; + +const noop = () => {}; + +// Documented gaps: the letter avatar is 3.30:1, and a disabled delete-only chip +// is not exposed as disabled, so axe rates its faded label as an active control. +export default function ChipA11yKnownGaps() { + return ( + + M} label="With avatar" onDelete={noop} /> + + + ); +} diff --git a/test/regressions/a11y/fixtures/chips/ChipA11yLongLabel.js b/test/regressions/a11y/fixtures/chips/ChipA11yLongLabel.js new file mode 100644 index 00000000000000..3af9e38a8538fa --- /dev/null +++ b/test/regressions/a11y/fixtures/chips/ChipA11yLongLabel.js @@ -0,0 +1,27 @@ +import Stack from '@mui/material/Stack'; +import Chip from '@mui/material/Chip'; + +const noop = () => {}; + +// The label does not wrap, so it ends with an ellipsis when the chip is too +// narrow. The first chip fits its 240px container at 100% text size. The second +// fits a wide viewport but not 320 CSS px. The third uses the wrapping styles +// from the MultilineChips docs demo. +export default function ChipA11yLongLabel() { + return ( + + + + + + + + ); +} diff --git a/test/regressions/a11y/fixtures/chips/ChipA11ySemanticStates.js b/test/regressions/a11y/fixtures/chips/ChipA11ySemanticStates.js new file mode 100644 index 00000000000000..1967cce680d0cf --- /dev/null +++ b/test/regressions/a11y/fixtures/chips/ChipA11ySemanticStates.js @@ -0,0 +1,27 @@ +import Stack from '@mui/material/Stack'; +import Chip from '@mui/material/Chip'; +import FaceIcon from '@mui/icons-material/Face'; + +const noop = () => {}; + +export default function ChipA11ySemanticStates() { + return ( + + + + + + + + + + + + + + + } label="With icon" variant="outlined" /> + + + ); +} diff --git a/test/regressions/demoMeta.test.ts b/test/regressions/demoMeta.test.ts index 3b66852404ebe8..3e5f0ceaa5a150 100644 --- a/test/regressions/demoMeta.test.ts +++ b/test/regressions/demoMeta.test.ts @@ -137,6 +137,32 @@ describe('getConfig', () => { ).to.deep.include({ enabled: true, assertions: 'all' }); }); + it('asserts every rule on the Chip demos and records only the documented contrast gaps', () => { + expect(getConfig(A11Y_RULES, 'docs/data/material/components/chips/BasicChips')).to.deep.include( + { + enabled: true, + assertions: 'all', + }, + ); + expect( + getConfig(A11Y_RULES, 'docs/data/material/components/chips/BasicChips'), + ).not.to.have.property('skipAssertions'); + expect( + getConfig(A11Y_RULES, 'docs/data/material/components/chips/AvatarChips'), + ).to.deep.include({ + skipAssertions: ['color-contrast'], + }); + expect( + getConfig(A11Y_RULES, 'test/regressions/a11y/fixtures/chips/ChipA11ySemanticStates'), + ).not.to.have.property('skipAssertions'); + expect( + getConfig(A11Y_RULES, 'test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps'), + ).to.deep.include({ skipAssertions: ['color-contrast'] }); + expect(getConfig(A11Y_RULES, 'docs/data/material/components/chips/ChipsPlayground')).to.equal( + undefined, + ); + }); + it('returns undefined for a radio demo outside the enrolment', () => { // The radio-buttons enrolment omits FormControlLabelPlacement. expect( diff --git a/test/regressions/demoMeta.ts b/test/regressions/demoMeta.ts index 6469ebe98df752..fbb59d89901009 100644 --- a/test/regressions/demoMeta.ts +++ b/test/regressions/demoMeta.ts @@ -240,6 +240,23 @@ const BUTTON_A11Y_DEMOS = [ 'CustomizedButtons', ]; +// Chip docs demos enrolled for axe assertions. ChipsPlayground needs Redux isolation. +const CHIP_A11Y_DEMOS = [ + 'BasicChips', + 'ClickableChips', + 'DeletableChips', + 'ClickableAndDeletableChips', + 'ClickableLinkChips', + 'CustomDeleteIconChips', + // A later rule overrides AvatarChips to skip `color-contrast`. + 'AvatarChips', + 'IconChips', + 'ColorChips', + 'SizesChips', + 'MultilineChips', + 'ChipsArray', +]; + // Radio docs demos enrolled for axe assertions. FormControlLabelPlacement is left out: its axe // output duplicates RowRadioButtonsGroup (a row RadioGroup with a FormLabel), adding no new rules. const RADIO_A11Y_DEMOS = [ @@ -406,6 +423,36 @@ export const A11Y_RULES: A11yRule[] = [ enabled: true, assertions: 'all', }, + { + test: `docs/data/material/components/chips/{${CHIP_A11Y_DEMOS.join(',')}}`, + enabled: true, + assertions: 'all', + }, + // axe cannot resolve the label background next to the image avatar, so + // `color-contrast` returns incomplete. + { + test: 'docs/data/material/components/chips/AvatarChips', + enabled: true, + assertions: 'all', + skipAssertions: ['color-contrast'], + }, + // A11y-only fixtures under `test/regressions/a11y/fixtures/chips/`; the suite + // name maps their results into the same `chips.a11y.json`. + { + test: 'test/regressions/a11y/fixtures/chips/{ChipA11ySemanticStates,ChipA11yLongLabel}', + enabled: true, + assertions: 'all', + }, + // `color-contrast` is recorded but not asserted. These are documented gaps + // (1.4.3, 4.1.2) in `packages/mui-material/src/Chip/accessibility.md`: `info` + // and `warning` labels, the letter avatar, and a disabled delete-only chip, + // which axe sees as an active control. + { + test: 'test/regressions/a11y/fixtures/chips/{ChipA11yColorMatrix,ChipA11yKnownGaps}', + enabled: true, + assertions: 'all', + skipAssertions: ['color-contrast'], + }, { test: `docs/data/material/components/radio-buttons/{${RADIO_A11Y_DEMOS.join(',')}}`, enabled: true, diff --git a/test/regressions/fixtures/FocusVisible/KeyboardRing.js b/test/regressions/fixtures/FocusVisible/KeyboardRing.js index 1cb56457d2682e..619bf5aeafe3a4 100644 --- a/test/regressions/fixtures/FocusVisible/KeyboardRing.js +++ b/test/regressions/fixtures/FocusVisible/KeyboardRing.js @@ -5,6 +5,7 @@ import AccordionDetails from '@mui/material/AccordionDetails'; import AccordionSummary from '@mui/material/AccordionSummary'; import Button from '@mui/material/Button'; import Checkbox from '@mui/material/Checkbox'; +import Chip from '@mui/material/Chip'; import Radio from '@mui/material/Radio'; import Stack from '@mui/material/Stack'; import Switch from '@mui/material/Switch'; @@ -39,6 +40,7 @@ export default function KeyboardRing() { Contained + {}} /> Toggle diff --git a/test/regressions/index.test.js b/test/regressions/index.test.js index c3fd76c8d25f11..fab208b0b535b3 100644 --- a/test/regressions/index.test.js +++ b/test/regressions/index.test.js @@ -506,6 +506,60 @@ async function main() { }); }); }); + describe('Chip', () => { + // A tripwire for the documented 1.4.4, 1.4.10, and 1.4.12 gaps: the label does + // not wrap, so text that fits at the default size ends with an ellipsis. When + // this fails, Chip wraps its label: update Chip/accessibility.md and knownGaps.json. + const ROUTE = '/a11y-chips/ChipA11yLongLabel'; + const truncated = (page, index) => + page.evaluate((i) => { + const label = document.querySelectorAll('.MuiChip-label')[i]; + return label.scrollWidth > label.clientWidth + 1; + }, index); + + test('known gap: a label that fits at 100% is truncated at 200% text and with WCAG text spacing', async ({ + pooled, + }) => { + const { page } = pooled; + await renderFixture(page, ROUTE); + if (await truncated(page, 0)) { + throw new Error('ChipA11yLongLabel no longer fits at 100%; pick a shorter label'); + } + for (const css of [ + 'html { font-size: 200% !important; }', + '* { line-height: 1.5 !important; letter-spacing: 0.12em !important; word-spacing: 0.16em !important; }', + ]) { + // eslint-disable-next-line no-await-in-loop + const style = await page.addStyleTag({ content: css }); + // eslint-disable-next-line no-await-in-loop + if (!(await truncated(page, 0))) { + throw new Error(`Chip label no longer truncates with ${css}; the gap may be fixed`); + } + // eslint-disable-next-line no-await-in-loop + await style.evaluate((node) => node.remove()); + } + }); + + test('known gap: a label that fits a wide viewport is truncated at 320 CSS px', async ({ + pooled, + }) => { + const { page } = pooled; + await renderFixture(page, ROUTE); + if (await truncated(page, 1)) { + throw new Error('ChipA11yLongLabel no longer fits at the default viewport'); + } + await page.setViewportSize({ width: 320, height: 512 }); + try { + await renderFixture(page, ROUTE); + if (!(await truncated(page, 1))) { + throw new Error('Chip label no longer truncates at 320 CSS px; the gap may be fixed'); + } + } finally { + await page.setViewportSize(DEFAULT_VIEWPORT); + } + }); + }); + describe('Avatar', () => { // Deterministic clip check for 1.4.12 Text Spacing, which axe cannot cover. // Renders `LetterAvatars` and targets the two-character ("OP") avatar, @@ -718,6 +772,7 @@ function registerFocusVisibleSuites({ test, renderFixture, routes }) { { component: 'Button (outlined)', route: RING_ROUTE, selector: '.MuiButton-outlined' }, { component: 'Button (contained)', route: RING_ROUTE, selector: '.MuiButton-contained' }, { component: 'Checkbox', route: RING_ROUTE, selector: '.MuiCheckbox-root' }, + { component: 'Chip', route: RING_ROUTE, selector: '.MuiChip-clickable' }, { component: 'Radio', route: RING_ROUTE, selector: '.MuiRadio-root' }, { component: 'Switch', route: RING_ROUTE, selector: '.MuiSwitch-root' }, { component: 'ToggleButton', route: RING_ROUTE, selector: '.MuiToggleButton-root' }, From 6057a637a29826e294179138bddda138526340dd Mon Sep 17 00:00:00 2001 From: michel Date: Thu, 29 Oct 2026 15:59:27 +0100 Subject: [PATCH 02/12] Address review feedback Co-Authored-By: Claude Opus 5.5 --- .../accessibility/accessibility.md | 26 +++---- .../accessibility/knownGaps.json | 11 ++- .../accessibility/scorecard.json | 27 +++---- packages/mui-material/src/Chip/Chip.test.js | 26 +++++++ .../mui-material/src/Chip/accessibility.json | 4 +- .../mui-material/src/Chip/accessibility.md | 78 ++++++++++--------- packages/mui-material/src/accessibility.md | 2 +- packages/mui-material/src/manual-testing.md | 9 ++- .../a11y/fixtures/chips/ChipA11yKnownGaps.js | 3 +- test/regressions/demoMeta.ts | 5 +- test/regressions/index.test.js | 15 +++- 11 files changed, 124 insertions(+), 82 deletions(-) diff --git a/docs/data/material/getting-started/accessibility/accessibility.md b/docs/data/material/getting-started/accessibility/accessibility.md index cda42c49f87b94..72b64926fe2801 100644 --- a/docs/data/material/getting-started/accessibility/accessibility.md +++ b/docs/data/material/getting-started/accessibility/accessibility.md @@ -42,7 +42,7 @@ Each row counts only the criteria that **apply** to that component; criteria tha | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md) | 5 | 6 | 11 | 9 | 2 | 6/11 | 2 | | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) | 15 | 12 | 27 | 24 | 3 | 20/27 | 11 | | [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 22/25 | 11 | -| [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | 13 | 11 | 24 | 15 | 9 | 15/24 | 5 | +| [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | 13 | 11 | 24 | 16 | 8 | 15/24 | 4 | | [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 6/11 | 1 | | [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 6/11 | 1 | | [Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 23/25 | 11 | @@ -58,7 +58,7 @@ Each row counts only the criteria that **apply** to that component; criteria tha **No component records a ❌ Does Not Support rating for any Level A or AA criterion.** -Rolled up to the library level, where each criterion takes the worst rating any assessed component receives, 32 success criteria are exercised: **20 Supports, 12 Partially Supports, 0 Does Not Support.** +Rolled up to the library level, where each criterion takes the worst rating any assessed component receives, 32 success criteria are exercised: **21 Supports, 11 Partially Supports, 0 Does Not Support.** @@ -85,17 +85,17 @@ Each ⚠️ rating comes from one of the issues below. Some of them can be fixed -| Gap | Criteria | Affected | Workaround | -| :-------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | -| **By default, the keyboard focus indicator is the ripple or a background tint, and its contrast can fall below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [AccordionSummary](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/AccordionSummary/accessibility.md)
    [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
    [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md)
    [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md)
    [Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md)
    [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
    [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Enable `focusVisible` in your theme — see below | -| **Some default palette colors fall short of contrast minimums** | [1.4.3 Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
    [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md)
    [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
    [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`info`, `warning`, letter avatar)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`warning` with `enableTrackSlot`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
    [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
    [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md)
    [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Override the affected palette entries | -| **The selected state of colored Toggle Buttons is conveyed almost entirely by hue** | [1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) | [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) (`primary`, `error`, `info`, `success`) | Add a non-color cue to the selected state, such as an icon | -| **A Chip label does not wrap, so a long label ends with an ellipsis and hides text** | [1.4.4 Resize Text](https://www.w3.org/WAI/WCAG22/Understanding/resize-text.html)
    [1.4.10 Reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html)
    [1.4.12 Text Spacing](https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | Let the label wrap with `height: 'auto'` and `whiteSpace: 'normal'`, as in the multiline demo | -| **A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and deletable** | [1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html)
    [4.1.2 Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`) | Describe the delete key with `aria-describedby`, and set `skipFocusWhenDisabled` on disabled chips | -| **Deleting a Chip with the keyboard moves focus to the page** | [2.4.3 Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`) | Move focus to the next chip, or to the input, in the `onDelete` handler | -| **The Chip delete icon is smaller than 24 by 24 CSS px, and its contrast is below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html)
    [2.5.8 Target Size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (16 px `small`, 22 px `medium`) | Enlarge the icon, and give it a darker color, with `sx` on `.MuiChip-deleteIcon` | -| **Dynamic state changes are not announced** | [4.1.3 Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
    [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md) (error) | Render your own `aria-live` region alongside | -| **Indefinite animation cannot be paused** | [2.2.2 Pause, Stop, Hide](https://www.w3.org/WAI/WCAG22/Understanding/pause-stop-hide.html) | [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`indeterminate`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) (`indeterminate`, `query`, `buffer`) | Show it only while an operation is in flight | +| Gap | Criteria | Affected | Workaround | +| :-------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------- | +| **By default, the keyboard focus indicator is the ripple or a background tint, and its contrast can fall below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [AccordionSummary](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/AccordionSummary/accessibility.md)
    [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
    [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md)
    [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md)
    [Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md)
    [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
    [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Enable `focusVisible` in your theme — see below | +| **Some default palette colors fall short of contrast minimums** | [1.4.3 Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
    [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md)
    [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
    [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`info`, `warning`, focused or hovered `outlined`, letter avatar, disabled delete-only)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`warning` with `enableTrackSlot`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
    [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
    [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md)
    [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Override the affected palette entries | +| **The selected state of colored Toggle Buttons is conveyed almost entirely by hue** | [1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) | [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) (`primary`, `error`, `info`, `success`) | Add a non-color cue to the selected state, such as an icon | +| **A Chip label does not wrap, so a long label ends with an ellipsis and hides text** | [1.4.10 Reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html)
    [1.4.12 Text Spacing](https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | Let the label wrap with `height: 'auto'` and `whiteSpace: 'normal'`, as in the multiline demo | +| **A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and deletable** | [1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html)
    [4.1.2 Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`; delete-only ignores Enter, Space) | Describe the delete key with `aria-describedby`, and set `skipFocusWhenDisabled` on disabled chips | +| **Deleting a Chip with the keyboard moves focus to the page body** | [2.4.3 Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`) | Move focus to the next chip, or to the input, in the `onDelete` handler | +| **The Chip delete icon is smaller than 24 by 24 CSS px, and its contrast is below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html)
    [2.5.8 Target Size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (16 px `small`, 22 px `medium`) | Enlarge the icon, and give it a darker color, with `sx` on `.MuiChip-deleteIcon` | +| **Dynamic state changes are not announced** | [4.1.3 Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
    [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md) (error) | Render your own `aria-live` region alongside | +| **Indefinite animation cannot be paused** | [2.2.2 Pause, Stop, Hide](https://www.w3.org/WAI/WCAG22/Understanding/pause-stop-hide.html) | [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`indeterminate`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) (`indeterminate`, `query`, `buffer`) | Show it only while an operation is in flight | diff --git a/docs/data/material/getting-started/accessibility/knownGaps.json b/docs/data/material/getting-started/accessibility/knownGaps.json index c24d0dc0db592a..798059dca3138d 100644 --- a/docs/data/material/getting-started/accessibility/knownGaps.json +++ b/docs/data/material/getting-started/accessibility/knownGaps.json @@ -19,7 +19,10 @@ "affected": [ "Avatar", "Button", - { "component": "Chip", "note": "`info`, `warning`, letter avatar" }, + { + "component": "Chip", + "note": "`info`, `warning`, focused or hovered `outlined`, letter avatar, disabled delete-only" + }, { "component": "CircularProgress", "note": "`warning` with `enableTrackSlot`" }, "LinearProgress", "Switch", @@ -36,18 +39,18 @@ }, { "gap": "A Chip label does not wrap, so a long label ends with an ellipsis and hides text", - "criteria": ["1.4.4", "1.4.10", "1.4.12"], + "criteria": ["1.4.10", "1.4.12"], "affected": ["Chip"], "workaround": "Let the label wrap with `height: 'auto'` and `whiteSpace: 'normal'`, as in the multiline demo" }, { "gap": "A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and deletable", "criteria": ["1.1.1", "4.1.2"], - "affected": [{ "component": "Chip", "note": "`onDelete`" }], + "affected": [{ "component": "Chip", "note": "`onDelete`; delete-only ignores Enter, Space" }], "workaround": "Describe the delete key with `aria-describedby`, and set `skipFocusWhenDisabled` on disabled chips" }, { - "gap": "Deleting a Chip with the keyboard moves focus to the page", + "gap": "Deleting a Chip with the keyboard moves focus to the page body", "criteria": ["2.4.3"], "affected": [{ "component": "Chip", "note": "`onDelete`" }], "workaround": "Move focus to the next chip, or to the input, in the `onDelete` handler" diff --git a/docs/data/material/getting-started/accessibility/scorecard.json b/docs/data/material/getting-started/accessibility/scorecard.json index 67c9c2f5cd643c..ac2fb2b6729803 100644 --- a/docs/data/material/getting-started/accessibility/scorecard.json +++ b/docs/data/material/getting-started/accessibility/scorecard.json @@ -3,8 +3,8 @@ "componentCount": 14, "totals": { "rated": 32, - "supports": 20, - "partiallySupports": 12, + "supports": 21, + "partiallySupports": 11, "doesNotSupport": 0, "flagged": 16 }, @@ -69,9 +69,9 @@ "number": "1.4.4", "name": "Resize Text", "level": "AA", - "conformance": "Partially Supports", + "conformance": "Supports", "flagged": true, - "affected": ["Chip"] + "affected": [] }, { "number": "1.4.5", @@ -1403,8 +1403,8 @@ { "component": "Chip", "counts": { - "supports": 15, - "partiallySupports": 9, + "supports": 16, + "partiallySupports": 8, "doesNotSupport": 0, "notApplicable": 31, "flagged": 9, @@ -1421,11 +1421,6 @@ "name": "Contrast (Minimum)", "conformance": "Partially Supports" }, - { - "number": "1.4.4", - "name": "Resize Text", - "conformance": "Partially Supports" - }, { "number": "1.4.10", "name": "Reflow", @@ -1516,7 +1511,7 @@ "number": "1.4.4", "name": "Resize Text", "level": "AA", - "conformance": "Partially Supports", + "conformance": "Supports", "responsibility": "Shared", "group": "Hybrid", "flagged": false @@ -1563,7 +1558,7 @@ "level": "A", "conformance": "Supports", "responsibility": "Component", - "group": "Automated", + "group": "Hybrid", "flagged": false }, { @@ -1679,11 +1674,11 @@ "rated": 24, "levelA": 13, "levelAA": 11, - "supports": 15, - "partiallySupports": 9, + "supports": 16, + "partiallySupports": 8, "doesNotSupport": 0, "verified": 15, - "automated": 5 + "automated": 4 } }, { diff --git a/packages/mui-material/src/Chip/Chip.test.js b/packages/mui-material/src/Chip/Chip.test.js index 66a881def61653..50cbb5c87f427d 100644 --- a/packages/mui-material/src/Chip/Chip.test.js +++ b/packages/mui-material/src/Chip/Chip.test.js @@ -880,6 +880,32 @@ describe('', () => { ...FAILING_PALETTE_COLORS, ]); }); + + it('focused outlined labels fall short of 4.5:1 in every palette color except secondary', () => { + render( + + {PALETTE_CONTRAST_COLORS.map((color) => ( + {}} + className={classes.focusVisible} + /> + ))} + , + ); + const failing = PALETTE_CONTRAST_COLORS.filter((color) => { + const chip = screen.getByRole('button', { name: color }); + const { color: textColor, backgroundColor } = window.getComputedStyle(chip); + // The focus tint is `main` at `focusOpacity`, so composite it over the paper. + const fill = blend(backgroundColor, 1, theme.palette.background.paper); + return contrastRatio(textColor, fill) < WCAG_MINIMUM_RATIO.normalText; + }); + // When this changes, update Chip/accessibility.md and knownGaps.json. + expect(failing).to.deep.equal(['primary', 'error', 'info', 'success', 'warning']); + }); }); it('1.4.11 Non-text Contrast: the default delete icon falls short of 3:1 (documented gap)', () => { diff --git a/packages/mui-material/src/Chip/accessibility.json b/packages/mui-material/src/Chip/accessibility.json index cba427b5f4ad78..01153179efffe4 100644 --- a/packages/mui-material/src/Chip/accessibility.json +++ b/packages/mui-material/src/Chip/accessibility.json @@ -17,7 +17,6 @@ "responsibility": "Component" }, "1.4.4": { - "conformance": "Partially Supports", "group": "Hybrid" }, "1.4.10": { @@ -28,6 +27,9 @@ "conformance": "Partially Supports", "group": "Hybrid" }, + "2.1.1": { + "group": "Hybrid" + }, "2.4.3": { "conformance": "Partially Supports", "group": "Hybrid", diff --git a/packages/mui-material/src/Chip/accessibility.md b/packages/mui-material/src/Chip/accessibility.md index b03655b4521ebd..6f3c949a889f69 100644 --- a/packages/mui-material/src/Chip/accessibility.md +++ b/packages/mui-material/src/Chip/accessibility.md @@ -6,8 +6,8 @@ Rated against WCAG 2.2 Level A and AA. See the [reports legend](../accessibility | Result | Count | | :-------------------- | :---- | -| ✅ Supports | 15 | -| ⚠️ Partially Supports | 9 | +| ✅ Supports | 16 | +| ⚠️ Partially Supports | 8 | | ❌ Does Not Support | 0 | | ➖ Not Applicable | 31 | | 🚩 Flagged | 9/24 | @@ -15,14 +15,13 @@ Rated against WCAG 2.2 Level A and AA. See the [reports legend](../accessibility ## Known gaps - ⚠️ **1.1.1 Non-text Content.** The delete icon tells sighted users that the chip can be deleted. No text gives this information to a screen-reader user. -- ⚠️ **1.4.3 Contrast (Minimum).** `info` and `warning` labels are less than `4.5:1` in the `filled` and `outlined` variants. A letter avatar is `3.30:1`. -- ⚠️ **1.4.4 Resize Text.** The label does not wrap. At a 200% text size, a label that fits at 100% ends with an ellipsis and hides text. +- ⚠️ **1.4.3 Contrast (Minimum).** `info` and `warning` labels are less than `4.5:1` in the `filled` and `outlined` variants. A letter avatar is `3.30:1`. On a focused `outlined` chip, all colors except `secondary` are less than `4.5:1`. On a hovered clickable `outlined` chip, `primary` is also less than `4.5:1`. The faded label of a disabled delete-only chip is `2.14:1`. - ⚠️ **1.4.10 Reflow.** The label does not wrap. At 320 CSS px, a label that fits a wide layout ends with an ellipsis. - ⚠️ **1.4.11 Non-text Contrast.** The default delete icon is `1.86:1` on a `filled` chip and `1.88:1` on an `outlined` chip. The focused background is `1.61:1` against the page. - ⚠️ **1.4.12 Text Spacing.** The label does not wrap. With the WCAG text-spacing values, a label that fits at default spacing can end with an ellipsis. - ⚠️ **2.4.3 Focus Order.** The component does not move focus after a deletion. In the ChipsArray demo, a keyboard deletion moves focus to the page body. - ⚠️ **2.5.8 Target Size (Minimum).** The delete icon is 22 px on a `medium` chip. It is 16 px on a `small` chip. On a clickable and deletable chip, the chip itself is a target, so the spacing exception does not apply. -- ⚠️ **4.1.2 Name, Role, Value.** The component does not set `aria-disabled` on a disabled delete-only chip. The chip stays focusable, and Backspace still deletes it. +- ⚠️ **4.1.2 Name, Role, Value.** The component does not set `aria-disabled` on a disabled delete-only chip. The chip stays focusable, and Backspace still deletes it. A delete-only chip has the button role, but Enter and Space do nothing. ## Success criteria @@ -190,41 +189,46 @@ Tested by: unit `Chip.test.js` · axe-core `color-contrast` ❌ - A `filled` chip renders `contrastText` on `main`. An `outlined` chip renders `main` on the page. In both variants, `info` (`3.86:1`) and `warning` (`3.11:1`) are less than `4.5:1`. - Unit tests compare the results with the [palette contrast contract](../../test/contrastContract.ts). Only these colors fail. axe-core `color-contrast` fails on the color fixture. - The `default` color is `text.primary` on `action.selected`, about `13.9:1`. -- A letter avatar in a chip renders `grey[700]` on `grey[400]`, `3.30:1`. +- On a focused `outlined` chip, the background is `main` at `focusOpacity` (`0.12`) on the page, and the label stays `main`. Only `secondary` stays at `4.5:1` or more: `primary` `3.93:1`, `secondary` `5.21:1`, `error` `4.15:1`, `info` `3.33:1`, `success` `4.37:1`, `warning` `2.73:1`. A unit test confirms this set. +- On a hovered clickable `outlined` chip, the background is `main` at `hoverOpacity` (`0.04`). `primary` (`4.37:1`), `info` (`3.67:1`), and `warning` (`2.98:1`) are less than `4.5:1`. `secondary` is `5.92:1`, `error` is `4.69:1`, and `success` is `4.87:1`. +- A letter avatar in a chip renders `grey[700]` on `grey[400]`, `3.30:1`. axe-core marks one-letter text as incomplete, so the `ChipA11yKnownGaps` fixture uses a two-letter avatar to record the failure. - A disabled chip is exempt. But a disabled delete-only chip still deletes on Backspace, so it is not an inactive component, and its faded label (`2.14:1`, measured by axe-core) is a real failure. - All values are for the light palette. **Manual testing steps** 1. With a contrast checker, measure the label against the chip background, for each color and variant in use. -2. Measure the letter of any letter avatar. +2. Press Tab to an `outlined` deletable chip, and measure the label against the focused background. +3. Move the pointer over an `outlined` clickable chip, and measure the label against the hovered background. +4. Measure the letter of any letter avatar. +5. Measure the label of any disabled delete-only chip. -**Pass:** each label is at least `4.5:1`. `info`, `warning`, and the letter avatar fail. +**Pass:** each label is at least `4.5:1` at rest, on hover, and on focus. `info` and `warning` fail. On an `outlined` chip, all focused labels except `secondary` fail, and the hovered `primary` label fails. The letter avatar and the disabled delete-only label fail. #### 1.4.4 Resize Text · AA -`⚠️ Partially Supports` · `◐ Shared` +`✅ Supports` · `◐ Shared` Tested by: Playwright -- The label uses `rem`, so it scales with the text size. A Playwright test confirms that the ChipsArray demo, with short labels, does not overflow at a 200% text size. -- The label does not wrap, and it ends with an ellipsis when the chip is too narrow. In the `ChipA11yLongLabel` fixture, a label fits its 240 px container at 100% (177 px). At a 200% text size, 219 px of the 331 px label is visible. A Playwright test confirms this gap. -- Full-page zoom scales the container too, so it does not cause this. Text-only resize does, and the library tests 1.4.4 with text-only resize. -- To fix it, let the label wrap with `height: 'auto'` on the chip, and `display: 'block'` and `whiteSpace: 'normal'` on the label, as the MultilineChips demo does. +- Under 200% page zoom, the chip, its container, and the label scale together, so a label that fits at 100% still fits. Page zoom decides the 1.4.4 rating (WCAG technique G142). The automated page-zoom check comes with the layout suite change in #49550, so this report confirms it with a manual step until then. +- Under text-only resize, the label grows but a px-wide container does not. The label does not wrap, so it ends with an ellipsis. In the `ChipA11yLongLabel` fixture, a label fits its 240 px container at 100% (177 px). At a 200% text size, 219 px of the 331 px label is visible. A Playwright test confirms this. +- A Playwright test confirms that the ChipsArray demo, with short labels, survives a 200% text-only resize. +- To make long labels safe under text-only resize, let the label wrap with `height: 'auto'` on the chip, and `display: 'block'` and `whiteSpace: 'normal'` on the label, as the MultilineChips demo does. **Manual testing steps** 1. Render a chip with a label that just fits its container. -2. Set the browser text size to 200%. +2. Set the browser zoom to 200%. 3. Make sure that the full label stays visible. -**Pass:** the full label stays visible. A long label fails with the default styles. +**Pass:** the full label stays visible at 200% page zoom. #### 1.4.10 Reflow · AA @@ -255,7 +259,7 @@ Tested by: unit `Chip.test.js` -- The delete icon is the only visual sign of the delete control. It is less than `3:1` in most combinations, in the light palette: +- The delete icon is the only visual sign of the delete control. It is less than `3:1` in 8 of the 14 color and variant combinations, in the light palette: - `default` `filled`: `text.primary` at `26%` on `action.selected`, `1.86:1`. - `default` `outlined`: `1.88:1` against white. - Palette `filled`: `contrastText` at `70%` on `main`, `2.22:1` (`warning`) to `3.83:1` (`secondary`). @@ -297,6 +301,27 @@ Tested by: Playwright · axe-core `avoid-inline-spacing` ✅ **Pass:** the full label stays visible. A long label fails with the default styles. +#### 2.1.1 Keyboard · A + +`✅ Supports` · `● Component` + +Tested by: unit `Chip.test.js`, `ButtonBase.test.js` + + + +- A clickable chip activates with Enter and Space. A deletable chip calls `onDelete` on the release of Backspace or Delete. Unit tests confirm both. The author's `onDelete` removes the chip. + +**Manual testing steps** + +1. Press Tab to a deletable chip in the ChipsArray demo. +2. Press Backspace or Delete. +3. Press Tab to a clickable chip. +4. Press Enter, then Space. + + + +**Pass:** the deletable chip is removed, and the clickable chip activates on each key. + #### 2.4.3 Focus Order · A `🚩` · `⚠️ Partially Supports` · `◐ Shared` @@ -423,27 +448,6 @@ Tested by: unit `Chip.test.js` · axe-core `aria-allowed-attr` ✅, `aria-comman ### ⚙️ Automated -#### 2.1.1 Keyboard · A - -`✅ Supports` · `● Component` - -Tested by: unit `Chip.test.js`, `ButtonBase.test.js` - - - -- A clickable chip activates with Enter and Space. A deletable chip calls `onDelete` on the release of Backspace or Delete. Unit tests confirm both. The author's `onDelete` removes the chip. - -**Manual testing steps** - -1. Press Tab to a deletable chip in the ChipsArray demo. -2. Press Backspace or Delete. -3. Press Tab to a clickable chip. -4. Press Enter, then Space. - - - -**Pass:** the deletable chip is removed, and the clickable chip activates on each key. - #### 2.1.2 No Keyboard Trap · A `✅ Supports` · `● Component` diff --git a/packages/mui-material/src/accessibility.md b/packages/mui-material/src/accessibility.md index 02615438a9a773..bdb542cebaa236 100644 --- a/packages/mui-material/src/accessibility.md +++ b/packages/mui-material/src/accessibility.md @@ -188,7 +188,7 @@ Edit the JSON files, not this table. | [Avatar](./Avatar/accessibility.md) | 9 | 2 | 0 | 44 | — | 5/11 | | [Button](./Button/accessibility.md) | 24 | 3 | 0 | 28 | — | 7/27 | | [Checkbox](./Checkbox/accessibility.md) | 24 | 1 | 0 | 30 | — | 3/25 | -| [Chip](./Chip/accessibility.md) | 15 | 9 | 0 | 31 | — | 9/24 | +| [Chip](./Chip/accessibility.md) | 16 | 8 | 0 | 31 | — | 9/24 | | [CircularProgress](./CircularProgress/accessibility.md) | 8 | 3 | 0 | 44 | — | 5/11 | | [LinearProgress](./LinearProgress/accessibility.md) | 8 | 3 | 0 | 44 | — | 5/11 | | [Radio](./Radio/accessibility.md) | 24 | 1 | 0 | 30 | — | 2/25 | diff --git a/packages/mui-material/src/manual-testing.md b/packages/mui-material/src/manual-testing.md index 1ed4f25e98ddb8..5efc49100a0db0 100644 --- a/packages/mui-material/src/manual-testing.md +++ b/packages/mui-material/src/manual-testing.md @@ -22,7 +22,7 @@ Run the rows matching what you touched, for the component you touched. | :----------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | | Styling, theme, or palette | 1.4.1 Use of Color; 1.4.3 Contrast (Minimum); 1.4.4 Resize Text; 1.4.5 Images of Text; 1.4.10 Reflow; 1.4.11 Non-text Contrast; 1.4.12 Text Spacing | | DOM structure, roles, or ARIA | 1.1.1 Non-text Content; 1.3.1 Info and Relationships; 1.3.2 Meaningful Sequence; 4.1.2 Name, Role, Value; 4.1.3 Status Messages | -| Keyboard, focus, or pointer handling | 2.4.3 Focus Order; 2.4.4 Link Purpose (In Context); 2.4.6 Headings and Labels; 2.4.7 Focus Visible; 2.5.8 Target Size (Minimum) | +| Keyboard, focus, or pointer handling | 2.1.1 Keyboard; 2.4.3 Focus Order; 2.4.4 Link Purpose (In Context); 2.4.6 Headings and Labels; 2.4.7 Focus Visible; 2.5.8 Target Size (Minimum) | | Labels, errors, or validation | 3.3.2 Labels or Instructions | | Motion or timing | 2.2.2 Pause, Stop, Hide | | Other | 2.3.1 Three Flashes or Below Threshold | @@ -95,16 +95,17 @@ Run the rows matching what you touched, for the component you touched. ## Chip -14 checks · full procedures in [`Chip/accessibility.md`](./Chip/accessibility.md) +15 checks · full procedures in [`Chip/accessibility.md`](./Chip/accessibility.md) - [ ] 🔁 **1.1.1 Non-text Content** — the screen reader tells the user that the chip can be deleted. Expected result from the source: it does not. To fix it, add a description with `aria-describedby`. - [ ] 🔁 **1.3.1 Info and Relationships** — each chip announces the correct role, and a list of chips is announced as a list. - [ ] 🔁 **1.4.1 Use of Color** — the meaning and the state of each chip stay clear without color. -- [ ] 🔁 **1.4.3 Contrast (Minimum)** — each label is at least `4.5:1`. `info`, `warning`, and the letter avatar fail. -- [ ] 🔁 **1.4.4 Resize Text** — the full label stays visible. A long label fails with the default styles. +- [ ] 🔁 **1.4.3 Contrast (Minimum)** — each label is at least `4.5:1` at rest, on hover, and on focus. `info` and `warning` fail. On an `outlined` chip, all focused labels except `secondary` fail, and the hovered `primary` label fails. The letter avatar and the disabled delete-only label fail. +- [ ] 🔁 **1.4.4 Resize Text** — the full label stays visible at 200% page zoom. - [ ] 🔁 **1.4.10 Reflow** — the full label stays visible. A long label fails with the default styles. - [ ] 🔁 **1.4.11 Non-text Contrast** — the delete icon and the focus indicator are at least `3:1`. The `outlined` border does not need `3:1`, because the label identifies the chip. It is `1.88:1` (default) and `2.23:1` to `3.57:1` (palette). The default delete icon and focus indicator fail. - [ ] 🔁 **1.4.12 Text Spacing** — the full label stays visible. A long label fails with the default styles. +- [ ] 🔁 **2.1.1 Keyboard** — the deletable chip is removed, and the clickable chip activates on each key. - [ ] 🔁 **2.4.3 Focus Order** — focus moves to a nearby chip or control, not to the top of the page. The ChipsArray demo fails. - [ ] 🔁 **2.4.4 Link Purpose (In Context)** — the destination of each link chip is clear. - [ ] 🔁 **2.4.6 Headings and Labels** — each label describes the item or the filter. diff --git a/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js b/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js index 0568ec754de636..667b520c019e59 100644 --- a/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js +++ b/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js @@ -6,10 +6,11 @@ const noop = () => {}; // Documented gaps: the letter avatar is 3.30:1, and a disabled delete-only chip // is not exposed as disabled, so axe rates its faded label as an active control. +// The avatar has two letters: axe marks one-letter text as incomplete, not as a fail. export default function ChipA11yKnownGaps() { return ( - M} label="With avatar" onDelete={noop} /> + MB} label="With avatar" onDelete={noop} /> ); diff --git a/test/regressions/demoMeta.ts b/test/regressions/demoMeta.ts index fbb59d89901009..0248fd8ed3e2b4 100644 --- a/test/regressions/demoMeta.ts +++ b/test/regressions/demoMeta.ts @@ -428,8 +428,9 @@ export const A11Y_RULES: A11yRule[] = [ enabled: true, assertions: 'all', }, - // axe cannot resolve the label background next to the image avatar, so - // `color-contrast` returns incomplete. + // `color-contrast` returns incomplete: axe cannot resolve the label background + // next to the image avatar, and it does not rate the one-letter avatar text. + // `ChipA11yKnownGaps` records the letter avatar fail with a two-letter avatar. { test: 'docs/data/material/components/chips/AvatarChips', enabled: true, diff --git a/test/regressions/index.test.js b/test/regressions/index.test.js index fab208b0b535b3..05d5acf9f79ffb 100644 --- a/test/regressions/index.test.js +++ b/test/regressions/index.test.js @@ -507,8 +507,8 @@ async function main() { }); }); describe('Chip', () => { - // A tripwire for the documented 1.4.4, 1.4.10, and 1.4.12 gaps: the label does - // not wrap, so text that fits at the default size ends with an ellipsis. When + // A tripwire for the text-only resize limitation (1.4.4) and the 1.4.10 and + // 1.4.12 gaps: the label does not wrap, so text that fits ends with an ellipsis. When // this fails, Chip wraps its label: update Chip/accessibility.md and knownGaps.json. const ROUTE = '/a11y-chips/ChipA11yLongLabel'; const truncated = (page, index) => @@ -516,8 +516,13 @@ async function main() { const label = document.querySelectorAll('.MuiChip-label')[i]; return label.scrollWidth > label.clientWidth + 1; }, index); + const whiteSpace = (page, index) => + page.evaluate( + (i) => getComputedStyle(document.querySelectorAll('.MuiChip-label')[i]).whiteSpace, + index, + ); - test('known gap: a label that fits at 100% is truncated at 200% text and with WCAG text spacing', async ({ + test('known gap: a label that fits at 100% is truncated at 200% text-only resize and with WCAG text spacing', async ({ pooled, }) => { const { page } = pooled; @@ -525,6 +530,10 @@ async function main() { if (await truncated(page, 0)) { throw new Error('ChipA11yLongLabel no longer fits at 100%; pick a shorter label'); } + // The spacing step has about 5 px of margin, so also pin the cause: the label does not wrap. + if ((await whiteSpace(page, 0)) !== 'nowrap') { + throw new Error('Chip label can wrap now; the gap may be fixed'); + } for (const css of [ 'html { font-size: 200% !important; }', '* { line-height: 1.5 !important; letter-spacing: 0.12em !important; word-spacing: 0.16em !important; }', From fc1eb0df6717059ef782d90087feb9652eeb20f1 Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 11:01:42 +0100 Subject: [PATCH 03/12] removed not needed tests and the Backspace handling in one --- packages/mui-material/src/Chip/Chip.test.js | 65 +-------------------- 1 file changed, 2 insertions(+), 63 deletions(-) diff --git a/packages/mui-material/src/Chip/Chip.test.js b/packages/mui-material/src/Chip/Chip.test.js index a597e30c0928c4..88eaa19e53c7db 100644 --- a/packages/mui-material/src/Chip/Chip.test.js +++ b/packages/mui-material/src/Chip/Chip.test.js @@ -510,7 +510,7 @@ describe('', () => { }); }); - describe('reacts to keyboard chip', () => { + describe('2.1.1 Keyboard: reacts to keyboard chip', () => { it('should call onKeyDown when a key is pressed', () => { const handleKeydown = stub().callsFake((event) => event.key); render( {}} onKeyDown={handleKeydown} />); @@ -937,28 +937,6 @@ describe('', () => { expect(ratio).to.be.below(WCAG_NON_TEXT_RATIO); }); - describe('2.1.1 Keyboard', () => { - it('activates a clickable chip with Enter and Space', async () => { - const handleClick = spy(); - const { user } = render(); - - await user.tab(); - await user.keyboard('{Enter}'); - await user.keyboard(' '); - expect(handleClick.callCount).to.equal(2); - }); - - it('deletes a deletable chip with Backspace and Delete', async () => { - const handleDelete = spy(); - const { user } = render(); - - await user.tab(); - await user.keyboard('{Backspace}'); - await user.keyboard('{Delete}'); - expect(handleDelete.callCount).to.equal(2); - }); - }); - it('2.1.2 No Keyboard Trap: keyboard focus can enter and leave the chip', async () => { const { user } = render( @@ -981,18 +959,6 @@ describe('', () => { }); describe('2.4.3 Focus Order', () => { - it('keeps a static chip out of the tab order', async () => { - const { user } = render( - - - - , - ); - - await user.tab(); - expect(screen.getByRole('button', { name: 'After' })).toHaveFocus(); - }); - it('makes clickable and deletable chips tab stops in DOM order', async () => { const { user } = render( @@ -1067,41 +1033,14 @@ describe('', () => { expect(screen.queryByRole('button')).to.equal(null); }); - it('gives a clickable chip the button role and its label as name', () => { - render( {}} />); - - expect(screen.getByRole('button', { name: 'Filter' })).not.to.equal(null); - }); - - it('gives a link chip the link role', () => { - render(); - - expect(screen.getByRole('link', { name: 'Docs' })).to.have.tagName('a'); - }); - it('does not expose the disabled state of a disabled delete-only chip (documented gap)', async () => { - const handleDelete = spy(); - const { user } = render(); + const { user } = render( {}} disabled />); const chip = screen.getByRole('button'); // When this fails, the gap is fixed: update Chip/accessibility.md and knownGaps.json. expect(chip).not.to.have.attribute('aria-disabled'); await user.tab(); expect(chip).toHaveFocus(); - await user.keyboard('{Backspace}'); - expect(handleDelete.callCount).to.equal(1); - }); - - it('removes a disabled delete-only chip from the tab order with skipFocusWhenDisabled', async () => { - const { user } = render( - - {}} disabled skipFocusWhenDisabled /> - - , - ); - - await user.tab(); - expect(screen.getByRole('button', { name: 'After' })).toHaveFocus(); }); it('exposes the disabled state of a disabled clickable chip', () => { From 342650b9c86e58f5e3a0434971f909e8a4155820 Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 11:03:48 +0100 Subject: [PATCH 04/12] updated ratings and gaps --- .../material/components/chips/chips.a11y.json | 2 +- .../accessibility/accessibility.md | 32 ++++---- .../accessibility/knownGaps.json | 4 +- .../accessibility/scorecard.json | 21 +++--- .../mui-material/src/Chip/accessibility.json | 5 +- .../mui-material/src/Chip/accessibility.md | 74 +++++++++---------- packages/mui-material/src/accessibility.md | 2 +- 7 files changed, 68 insertions(+), 72 deletions(-) diff --git a/docs/data/material/components/chips/chips.a11y.json b/docs/data/material/components/chips/chips.a11y.json index 5ead9b61cd695f..e401e75a5d8a8b 100644 --- a/docs/data/material/components/chips/chips.a11y.json +++ b/docs/data/material/components/chips/chips.a11y.json @@ -22,7 +22,7 @@ "tags": ["wcag2a"] }, "color-contrast": { - "status": "incomplete", + "status": "pass", "tags": ["wcag2aa"] } } diff --git a/docs/data/material/getting-started/accessibility/accessibility.md b/docs/data/material/getting-started/accessibility/accessibility.md index d42529a48533cd..2b49dfdb27ba89 100644 --- a/docs/data/material/getting-started/accessibility/accessibility.md +++ b/docs/data/material/getting-started/accessibility/accessibility.md @@ -42,7 +42,7 @@ Each row counts only the criteria that **apply** to that component; criteria tha | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md) | 5 | 6 | 11 | 9 | 2 | 6/11 | 2 | | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) | 16 | 12 | 28 | 23 | 5 | 19/28 | 10 | | [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 22/25 | 11 | -| [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | 13 | 11 | 24 | 16 | 8 | 15/24 | 4 | +| [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | 13 | 11 | 24 | 16 | 7 | 15/24 | 4 | | [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 6/11 | 1 | | [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) | 15 | 12 | 27 | 22 | 5 | 18/27 | 9 | | [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 6/11 | 1 | @@ -58,9 +58,9 @@ Each row counts only the criteria that **apply** to that component; criteria tha -**No component records a ❌ Does Not Support rating for any Level A or AA criterion.** +**1 criterion records a ❌ Does Not Support rating in at least one component.** -Rolled up to the library level, where each criterion takes the worst rating any assessed component receives, 32 success criteria are exercised: **21 Supports, 11 Partially Supports, 0 Does Not Support.** +Rolled up to the library level, where each criterion takes the worst rating any assessed component receives, 32 success criteria are exercised: **21 Supports, 10 Partially Supports, 1 Does Not Support.** @@ -87,19 +87,19 @@ Each ⚠️ rating comes from one of the issues below. Some of them can be fixed -| Gap | Criteria | Affected | Workaround | -| :-------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | -| **By default, the keyboard focus indicator is the ripple or a background tint, and its contrast can fall below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [AccordionSummary](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/AccordionSummary/accessibility.md)
    [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
    [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md)
    [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (the ring needs `disableFocusRipple` too)
    [Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md)
    [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
    [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Enable `focusVisible` in your theme — see below | -| **Some default palette colors fall short of contrast minimums** | [1.4.3 Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
    [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md)
    [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
    [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`info`, `warning`, focused or hovered `outlined`, letter avatar, disabled delete-only)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`warning` with `enableTrackSlot`)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (`info`, `warning`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
    [Link](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Link/accessibility.md) (link text, 1.4.3 only)
    [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
    [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md)
    [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Override the affected palette entries | -| **The selected state of colored Toggle Buttons is conveyed almost entirely by hue** | [1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) | [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) (`primary`, `error`, `info`, `success`) | Add a non-color cue to the selected state, such as an icon | -| **A Chip label does not wrap, so a long label ends with an ellipsis and hides text** | [1.4.10 Reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html)
    [1.4.12 Text Spacing](https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | Let the label wrap with `height: 'auto'` and `whiteSpace: 'normal'`, as in the multiline demo | -| **A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and deletable** | [1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html)
    [4.1.2 Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`; delete-only ignores Enter, Space) | Describe the delete key with `aria-describedby`, and set `skipFocusWhenDisabled` on disabled chips | -| **Deleting a Chip with the keyboard moves focus to the page body** | [2.4.3 Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`) | Move focus to the next chip, or to the input, in the `onDelete` handler | -| **The Chip delete icon is smaller than 24 by 24 CSS px, and its contrast is below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html)
    [2.5.8 Target Size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (16 px `small`, 22 px `medium`) | Enlarge the icon, and give it a darker color, with `sx` on `.MuiChip-deleteIcon` | -| **Links without an underline rely on color, and several link colors are below 3:1 against body text** | [1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) | [Link](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Link/accessibility.md) (`underline="none"`, `underline="hover"`) | Keep the default `underline="always"` for links in body text | -| **Dynamic state changes are not announced** | [4.1.3 Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (`loading`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
    [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md) (error) | Render your own `aria-live` region alongside | -| **Indefinite animation cannot be paused** | [2.2.2 Pause, Stop, Hide](https://www.w3.org/WAI/WCAG22/Understanding/pause-stop-hide.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`indeterminate`)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (`loading`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) (`indeterminate`, `query`, `buffer`) | Show it only while an operation is in flight | -| **A focused button that turns `loading` loses keyboard focus to the page** | [2.4.3 Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (`loading`) | Move focus to a nearby element before you set `loading`, and back when it ends | +| Gap | Criteria | Affected | Workaround | +| :--------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | +| **By default, the keyboard focus indicator is the ripple or a background tint, and its contrast can fall below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [AccordionSummary](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/AccordionSummary/accessibility.md)
    [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
    [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md)
    [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (the ring needs `disableFocusRipple` too)
    [Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md)
    [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
    [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Enable `focusVisible` in your theme — see below | +| **Some default palette colors fall short of contrast minimums** | [1.4.3 Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
    [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) | [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md)
    [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md)
    [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`info`, `warning`, focused or hovered `outlined`)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`warning` with `enableTrackSlot`)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (`info`, `warning`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
    [Link](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Link/accessibility.md) (link text, 1.4.3 only)
    [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md)
    [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md)
    [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | Override the affected palette entries | +| **The selected state of colored Toggle Buttons is conveyed almost entirely by hue** | [1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) | [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) (`primary`, `error`, `info`, `success`) | Add a non-color cue to the selected state, such as an icon | +| **A Chip label does not wrap, so a long label ends with an ellipsis and hides text** | [1.4.10 Reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html)
    [1.4.12 Text Spacing](https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | Let the label wrap with `height: 'auto'` and `whiteSpace: 'normal'`, as in the multiline demo | +| **A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and does not expose its disabled state** | [1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html)
    [4.1.2 Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`; delete-only ignores Enter, Space) | Describe the delete key with `aria-describedby`, and set `skipFocusWhenDisabled` on disabled chips | +| **Deleting a Chip with the keyboard moves focus to the page body** | [2.4.3 Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (`onDelete`) | Move focus to the next chip, or to the input, in the `onDelete` handler | +| **The Chip delete icon is smaller than 24 by 24 CSS px, and its contrast is below 3:1** | [1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html)
    [2.5.8 Target Size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html) | [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) (16 px `small`, 22 px `medium`) | Enlarge the icon, and give it a darker color, with `sx` on `.MuiChip-deleteIcon` | +| **Links without an underline rely on color, and several link colors are below 3:1 against body text** | [1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) | [Link](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Link/accessibility.md) (`underline="none"`, `underline="hover"`) | Keep the default `underline="always"` for links in body text | +| **Dynamic state changes are not announced** | [4.1.3 Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (`loading`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md)
    [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md) (error) | Render your own `aria-live` region alongside | +| **Indefinite animation cannot be paused** | [2.2.2 Pause, Stop, Hide](https://www.w3.org/WAI/WCAG22/Understanding/pause-stop-hide.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
    [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) (`indeterminate`)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (`loading`)
    [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) (`indeterminate`, `query`, `buffer`) | Show it only while an operation is in flight | +| **A focused button that turns `loading` loses keyboard focus to the page** | [2.4.3 Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) | [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) (`loading`)
    [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) (`loading`) | Move focus to a nearby element before you set `loading`, and back when it ends | diff --git a/docs/data/material/getting-started/accessibility/knownGaps.json b/docs/data/material/getting-started/accessibility/knownGaps.json index bd2fc4bfa7d284..b8575809526cb8 100644 --- a/docs/data/material/getting-started/accessibility/knownGaps.json +++ b/docs/data/material/getting-started/accessibility/knownGaps.json @@ -22,7 +22,7 @@ "Button", { "component": "Chip", - "note": "`info`, `warning`, focused or hovered `outlined`, letter avatar, disabled delete-only" + "note": "`info`, `warning`, focused or hovered `outlined`" }, { "component": "CircularProgress", "note": "`warning` with `enableTrackSlot`" }, { "component": "IconButton", "note": "`info`, `warning`" }, @@ -47,7 +47,7 @@ "workaround": "Let the label wrap with `height: 'auto'` and `whiteSpace: 'normal'`, as in the multiline demo" }, { - "gap": "A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and deletable", + "gap": "A deletable Chip does not expose its delete action, and a disabled delete-only Chip stays focusable and does not expose its disabled state", "criteria": ["1.1.1", "4.1.2"], "affected": [{ "component": "Chip", "note": "`onDelete`; delete-only ignores Enter, Space" }], "workaround": "Describe the delete key with `aria-describedby`, and set `skipFocusWhenDisabled` on disabled chips" diff --git a/docs/data/material/getting-started/accessibility/scorecard.json b/docs/data/material/getting-started/accessibility/scorecard.json index 0e0b6ac8536031..bc49660c1dfe4b 100644 --- a/docs/data/material/getting-started/accessibility/scorecard.json +++ b/docs/data/material/getting-started/accessibility/scorecard.json @@ -4,8 +4,8 @@ "totals": { "rated": 32, "supports": 21, - "partiallySupports": 11, - "doesNotSupport": 0, + "partiallySupports": 10, + "doesNotSupport": 1, "flagged": 16 }, "criteria": [ @@ -93,14 +93,13 @@ "number": "1.4.11", "name": "Non-text Contrast", "level": "AA", - "conformance": "Partially Supports", + "conformance": "Does Not Support", "flagged": true, "affected": [ "AccordionSummary", "Avatar", "Button", "Checkbox", - "Chip", "CircularProgress", "IconButton", "LinearProgress", @@ -1424,8 +1423,8 @@ "component": "Chip", "counts": { "supports": 16, - "partiallySupports": 8, - "doesNotSupport": 0, + "partiallySupports": 7, + "doesNotSupport": 1, "notApplicable": 31, "flagged": 9, "rated": 24 @@ -1449,7 +1448,7 @@ { "number": "1.4.11", "name": "Non-text Contrast", - "conformance": "Partially Supports" + "conformance": "Does Not Support" }, { "number": "1.4.12", @@ -1533,7 +1532,7 @@ "level": "AA", "conformance": "Supports", "responsibility": "Shared", - "group": "Hybrid", + "group": "Manual", "flagged": false }, { @@ -1558,7 +1557,7 @@ "number": "1.4.11", "name": "Non-text Contrast", "level": "AA", - "conformance": "Partially Supports", + "conformance": "Does Not Support", "responsibility": "Component", "group": "Hybrid", "flagged": true @@ -1695,8 +1694,8 @@ "levelA": 13, "levelAA": 11, "supports": 16, - "partiallySupports": 8, - "doesNotSupport": 0, + "partiallySupports": 7, + "doesNotSupport": 1, "verified": 15, "automated": 4 } diff --git a/packages/mui-material/src/Chip/accessibility.json b/packages/mui-material/src/Chip/accessibility.json index 01153179efffe4..8e6bdde04df4ac 100644 --- a/packages/mui-material/src/Chip/accessibility.json +++ b/packages/mui-material/src/Chip/accessibility.json @@ -17,7 +17,10 @@ "responsibility": "Component" }, "1.4.4": { - "group": "Hybrid" + "group": "Manual" + }, + "1.4.11": { + "conformance": "Does Not Support" }, "1.4.10": { "conformance": "Partially Supports", diff --git a/packages/mui-material/src/Chip/accessibility.md b/packages/mui-material/src/Chip/accessibility.md index 6f3c949a889f69..11b98d8e89bfda 100644 --- a/packages/mui-material/src/Chip/accessibility.md +++ b/packages/mui-material/src/Chip/accessibility.md @@ -7,21 +7,21 @@ Rated against WCAG 2.2 Level A and AA. See the [reports legend](../accessibility | Result | Count | | :-------------------- | :---- | | ✅ Supports | 16 | -| ⚠️ Partially Supports | 8 | -| ❌ Does Not Support | 0 | +| ⚠️ Partially Supports | 7 | +| ❌ Does Not Support | 1 | | ➖ Not Applicable | 31 | | 🚩 Flagged | 9/24 | ## Known gaps - ⚠️ **1.1.1 Non-text Content.** The delete icon tells sighted users that the chip can be deleted. No text gives this information to a screen-reader user. -- ⚠️ **1.4.3 Contrast (Minimum).** `info` and `warning` labels are less than `4.5:1` in the `filled` and `outlined` variants. A letter avatar is `3.30:1`. On a focused `outlined` chip, all colors except `secondary` are less than `4.5:1`. On a hovered clickable `outlined` chip, `primary` is also less than `4.5:1`. The faded label of a disabled delete-only chip is `2.14:1`. +- ⚠️ **1.4.3 Contrast (Minimum).** `info` and `warning` labels are less than `4.5:1` in the `filled` and `outlined` variants. On a focused `outlined` chip, all colors except `secondary` are less than `4.5:1`. On a hovered clickable `outlined` chip, `primary` is also less than `4.5:1`. - ⚠️ **1.4.10 Reflow.** The label does not wrap. At 320 CSS px, a label that fits a wide layout ends with an ellipsis. -- ⚠️ **1.4.11 Non-text Contrast.** The default delete icon is `1.86:1` on a `filled` chip and `1.88:1` on an `outlined` chip. The focused background is `1.61:1` against the page. +- ❌ **1.4.11 Non-text Contrast.** The default delete icon is `1.86:1` on a `filled` chip and `1.88:1` on an `outlined` chip. The focused background is `1.61:1` against the page. - ⚠️ **1.4.12 Text Spacing.** The label does not wrap. With the WCAG text-spacing values, a label that fits at default spacing can end with an ellipsis. - ⚠️ **2.4.3 Focus Order.** The component does not move focus after a deletion. In the ChipsArray demo, a keyboard deletion moves focus to the page body. - ⚠️ **2.5.8 Target Size (Minimum).** The delete icon is 22 px on a `medium` chip. It is 16 px on a `small` chip. On a clickable and deletable chip, the chip itself is a target, so the spacing exception does not apply. -- ⚠️ **4.1.2 Name, Role, Value.** The component does not set `aria-disabled` on a disabled delete-only chip. The chip stays focusable, and Backspace still deletes it. A delete-only chip has the button role, but Enter and Space do nothing. +- ⚠️ **4.1.2 Name, Role, Value.** The component does not set `aria-disabled` on a disabled delete-only chip, and the chip stays focusable. A delete-only chip has the button role, but Enter and Space do nothing. ## Success criteria @@ -61,6 +61,26 @@ Rated against WCAG 2.2 Level A and AA. See the [reports legend](../accessibility **Pass:** no instruction refers to a chip by color or position alone. +#### 1.4.4 Resize Text · AA + +`✅ Supports` · `◐ Shared` + + + +- Under 200% page zoom, the chip, its container, and the label scale together, so a label that fits at 100% still fits. Page zoom decides the 1.4.4 rating (WCAG technique G142). The automated page-zoom check comes with the layout suite change in #49550, so this report confirms it with a manual step until then. +- Under text-only resize, the label grows but a px-wide container does not. The label does not wrap, so it ends with an ellipsis. In the `ChipA11yLongLabel` fixture, a label fits its 240 px container at 100% (177 px). At a 200% text size, 219 px of the 331 px label is visible. A Playwright test confirms this. +- To make long labels safe under text-only resize, let the label wrap with `height: 'auto'` on the chip, and `display: 'block'` and `whiteSpace: 'normal'` on the label, as the MultilineChips demo does. + +**Manual testing steps** + +1. Render a chip with a label that just fits its container. +2. Set the browser zoom to 200%. +3. Make sure that the full label stays visible. + + + +**Pass:** the full label stays visible at 200% page zoom. + #### 1.4.5 Images of Text · AA `✅ Supports` · `○ Author` @@ -191,8 +211,7 @@ Tested by: unit `Chip.test.js` · axe-core `color-contrast` ❌ - The `default` color is `text.primary` on `action.selected`, about `13.9:1`. - On a focused `outlined` chip, the background is `main` at `focusOpacity` (`0.12`) on the page, and the label stays `main`. Only `secondary` stays at `4.5:1` or more: `primary` `3.93:1`, `secondary` `5.21:1`, `error` `4.15:1`, `info` `3.33:1`, `success` `4.37:1`, `warning` `2.73:1`. A unit test confirms this set. - On a hovered clickable `outlined` chip, the background is `main` at `hoverOpacity` (`0.04`). `primary` (`4.37:1`), `info` (`3.67:1`), and `warning` (`2.98:1`) are less than `4.5:1`. `secondary` is `5.92:1`, `error` is `4.69:1`, and `success` is `4.87:1`. -- A letter avatar in a chip renders `grey[700]` on `grey[400]`, `3.30:1`. axe-core marks one-letter text as incomplete, so the `ChipA11yKnownGaps` fixture uses a two-letter avatar to record the failure. -- A disabled chip is exempt. But a disabled delete-only chip still deletes on Backspace, so it is not an inactive component, and its faded label (`2.14:1`, measured by axe-core) is a real failure. +- A disabled chip is an inactive component, so it is exempt. This includes a disabled delete-only chip, because Backspace and Delete do nothing on it. axe-core still fails its faded label (`2.14:1`), because the chip has no `aria-disabled`. See 4.1.2. - All values are for the light palette. **Manual testing steps** @@ -200,35 +219,10 @@ Tested by: unit `Chip.test.js` · axe-core `color-contrast` ❌ 1. With a contrast checker, measure the label against the chip background, for each color and variant in use. 2. Press Tab to an `outlined` deletable chip, and measure the label against the focused background. 3. Move the pointer over an `outlined` clickable chip, and measure the label against the hovered background. -4. Measure the letter of any letter avatar. -5. Measure the label of any disabled delete-only chip. -**Pass:** each label is at least `4.5:1` at rest, on hover, and on focus. `info` and `warning` fail. On an `outlined` chip, all focused labels except `secondary` fail, and the hovered `primary` label fails. The letter avatar and the disabled delete-only label fail. - -#### 1.4.4 Resize Text · AA - -`✅ Supports` · `◐ Shared` - -Tested by: Playwright - - - -- Under 200% page zoom, the chip, its container, and the label scale together, so a label that fits at 100% still fits. Page zoom decides the 1.4.4 rating (WCAG technique G142). The automated page-zoom check comes with the layout suite change in #49550, so this report confirms it with a manual step until then. -- Under text-only resize, the label grows but a px-wide container does not. The label does not wrap, so it ends with an ellipsis. In the `ChipA11yLongLabel` fixture, a label fits its 240 px container at 100% (177 px). At a 200% text size, 219 px of the 331 px label is visible. A Playwright test confirms this. -- A Playwright test confirms that the ChipsArray demo, with short labels, survives a 200% text-only resize. -- To make long labels safe under text-only resize, let the label wrap with `height: 'auto'` on the chip, and `display: 'block'` and `whiteSpace: 'normal'` on the label, as the MultilineChips demo does. - -**Manual testing steps** - -1. Render a chip with a label that just fits its container. -2. Set the browser zoom to 200%. -3. Make sure that the full label stays visible. - - - -**Pass:** the full label stays visible at 200% page zoom. +**Pass:** each label is at least `4.5:1` at rest, on hover, and on focus. `info` and `warning` fail. On an `outlined` chip, all focused labels except `secondary` fail, and the hovered `primary` label fails. #### 1.4.10 Reflow · AA @@ -253,7 +247,7 @@ Tested by: Playwright #### 1.4.11 Non-text Contrast · AA -`🚩` · `⚠️ Partially Supports` · `● Component` +`🚩` · `❌ Does Not Support` · `● Component` Tested by: unit `Chip.test.js` @@ -265,7 +259,8 @@ Tested by: unit `Chip.test.js` - Palette `filled`: `contrastText` at `70%` on `main`, `2.22:1` (`warning`) to `3.83:1` (`secondary`). - Palette `outlined`: `main` at `70%`, `2.23:1` to `3.57:1`. - A unit test confirms that the default delete icon is less than `3:1`. -- On keyboard focus, the chip background gets darker. The focused `default` fill is `1.61:1` against the page. +- On keyboard focus, the chip background gets darker. The focused `default` fill is `1.61:1` against the page. On an `outlined` chip, the focus tint is about `1.14:1` to `1.21:1` against the page. +- The rating is Does Not Support, because most of the functionality fails: the delete icon fails in 8 of the 14 combinations, including both `default` ones, and the default focus indicator fails. - The `outlined` border is `grey[400]` (`1.88:1` against white), or `main` at `70%` (`2.23:1` to `3.57:1`). The label identifies the chip, so the border does not need `3:1`. - With `focusVisible: true` on the theme, keyboard focus draws the theme outline ring instead. A Playwright test confirms the ring. @@ -419,7 +414,7 @@ Tested by: axe-core `target-size` ✅ -**Pass:** the delete icon is at least 24 by 24 CSS px. Or, a 24 px circle on its center touches no other target. The default icon is 16 by 16 px. +**Pass:** the delete icon is at least 24 by 24 CSS px. Or, a 24 px circle on its center touches no other target. The default icon is 22 by 22 px on a `medium` chip, and 16 by 16 px on a `small` chip. #### 4.1.2 Name, Role, Value · A @@ -430,8 +425,8 @@ Tested by: unit `Chip.test.js` · axe-core `aria-allowed-attr` ✅, `aria-comman - A clickable chip has the button role, and its label is the name. A disabled clickable chip has `aria-disabled="true"`. Unit tests confirm this. -- The component does not set `aria-disabled` on a disabled delete-only chip. The chip stays focusable, and Backspace still calls `onDelete`. A unit test confirms this gap. -- `skipFocusWhenDisabled` removes a disabled chip from the tab order, which also blocks Backspace. The state is still not exposed. +- The component does not set `aria-disabled` on a disabled delete-only chip, and the chip stays focusable. Backspace and Delete do nothing on it. A unit test confirms this gap. +- `skipFocusWhenDisabled` removes a disabled chip from the tab order. The state is still not exposed. - A delete-only chip has the button role, but Enter and Space do nothing. **Manual testing steps** @@ -440,11 +435,10 @@ Tested by: unit `Chip.test.js` · axe-core `aria-allowed-attr` ✅, `aria-comman 2. Press Tab past a static chip. Make sure that focus does not stop on it. 3. Press Tab to a clickable chip, a deletable chip, and a disabled deletable chip. 4. Listen to the name, role, and state of each. -5. On the disabled deletable chip, press Backspace. -**Pass:** each chip announces its label and "button". The disabled chip announces "disabled" and cannot be deleted. The disabled delete-only chip fails. +**Pass:** each chip announces its label and "button". The disabled chip announces "disabled". The disabled delete-only chip fails. ### ⚙️ Automated diff --git a/packages/mui-material/src/accessibility.md b/packages/mui-material/src/accessibility.md index 02d1a8aad15387..d09117f70c9d4a 100644 --- a/packages/mui-material/src/accessibility.md +++ b/packages/mui-material/src/accessibility.md @@ -188,7 +188,7 @@ Edit the JSON files, not this table. | [Avatar](./Avatar/accessibility.md) | 9 | 2 | 0 | 44 | — | 5/11 | | [Button](./Button/accessibility.md) | 23 | 5 | 0 | 27 | — | 9/28 | | [Checkbox](./Checkbox/accessibility.md) | 24 | 1 | 0 | 30 | — | 3/25 | -| [Chip](./Chip/accessibility.md) | 16 | 8 | 0 | 31 | — | 9/24 | +| [Chip](./Chip/accessibility.md) | 16 | 7 | 1 | 31 | — | 9/24 | | [CircularProgress](./CircularProgress/accessibility.md) | 8 | 3 | 0 | 44 | — | 5/11 | | [IconButton](./IconButton/accessibility.md) | 22 | 5 | 0 | 28 | — | 9/27 | | [LinearProgress](./LinearProgress/accessibility.md) | 8 | 3 | 0 | 44 | — | 5/11 | From 7d6a6d8175995aeca2900612ddf9e9eea1b0f33a Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 11:06:17 +0100 Subject: [PATCH 05/12] updated the test setup and test to also support color-contrast now --- test/regressions/demoMeta.test.ts | 4 +--- test/regressions/demoMeta.ts | 16 +++------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/test/regressions/demoMeta.test.ts b/test/regressions/demoMeta.test.ts index 13ac15aa5a5b2b..4552c01d6c6cdb 100644 --- a/test/regressions/demoMeta.test.ts +++ b/test/regressions/demoMeta.test.ts @@ -175,9 +175,7 @@ describe('getConfig', () => { ).not.to.have.property('skipAssertions'); expect( getConfig(A11Y_RULES, 'docs/data/material/components/chips/AvatarChips'), - ).to.deep.include({ - skipAssertions: ['color-contrast'], - }); + ).not.to.have.property('skipAssertions'); expect( getConfig(A11Y_RULES, 'test/regressions/a11y/fixtures/chips/ChipA11ySemanticStates'), ).not.to.have.property('skipAssertions'); diff --git a/test/regressions/demoMeta.ts b/test/regressions/demoMeta.ts index 811c82eefd2493..f5426401b4c2e0 100644 --- a/test/regressions/demoMeta.ts +++ b/test/regressions/demoMeta.ts @@ -295,7 +295,6 @@ const CHIP_A11Y_DEMOS = [ 'ClickableAndDeletableChips', 'ClickableLinkChips', 'CustomDeleteIconChips', - // A later rule overrides AvatarChips to skip `color-contrast`. 'AvatarChips', 'IconChips', 'ColorChips', @@ -500,15 +499,6 @@ export const A11Y_RULES: A11yRule[] = [ enabled: true, assertions: 'all', }, - // `color-contrast` returns incomplete: axe cannot resolve the label background - // next to the image avatar, and it does not rate the one-letter avatar text. - // `ChipA11yKnownGaps` records the letter avatar fail with a two-letter avatar. - { - test: 'docs/data/material/components/chips/AvatarChips', - enabled: true, - assertions: 'all', - skipAssertions: ['color-contrast'], - }, // A11y-only fixtures under `test/regressions/a11y/fixtures/chips/`; the suite // name maps their results into the same `chips.a11y.json`. { @@ -517,9 +507,9 @@ export const A11Y_RULES: A11yRule[] = [ assertions: 'all', }, // `color-contrast` is recorded but not asserted. These are documented gaps - // (1.4.3, 4.1.2) in `packages/mui-material/src/Chip/accessibility.md`: `info` - // and `warning` labels, the letter avatar, and a disabled delete-only chip, - // which axe sees as an active control. + // in `packages/mui-material/src/Chip/accessibility.md`: the `info` and `warning` + // labels (1.4.3). axe also fails the faded label of a disabled delete-only chip, + // because the chip has no `aria-disabled` (4.1.2). { test: 'test/regressions/a11y/fixtures/chips/{ChipA11yColorMatrix,ChipA11yKnownGaps}', enabled: true, From 9fbce658f35c43ffa8722774692c821dc2e919db Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 11:06:37 +0100 Subject: [PATCH 06/12] added a skipped criteria --- test/regressions/a11y/criteriaSuites.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/regressions/a11y/criteriaSuites.mjs b/test/regressions/a11y/criteriaSuites.mjs index f4bfcb79a2cd7e..8cd830f8a07122 100644 --- a/test/regressions/a11y/criteriaSuites.mjs +++ b/test/regressions/a11y/criteriaSuites.mjs @@ -22,7 +22,13 @@ export const CSS_LAYOUT_SUITES = [ }, { component: 'Button', route: '/docs-components-buttons/BasicButtons' }, { component: 'Checkbox', route: '/docs-components-checkboxes/Checkboxes' }, - { component: 'Chip', route: '/docs-components-chips/ChipsArray' }, + { + component: 'Chip', + route: '/docs-components-chips/ChipsArray', + // This suite tests 1.4.4 as text-only resize. The Chip report rates 1.4.4 on + // page zoom (G142), so it stays Manual until the page-zoom check in #49550. + skipCriteria: ['1.4.4'], + }, { component: 'CircularProgress', route: '/docs-components-progress/CircularDeterminate', From 195be99e95e4bed6b6e58704d26545b61504c385 Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 11:08:13 +0100 Subject: [PATCH 07/12] some more general changes --- packages/mui-material/src/manual-testing.md | 8 ++++---- scripts/a11yScorecard/render.mjs | 2 +- test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/mui-material/src/manual-testing.md b/packages/mui-material/src/manual-testing.md index 588ecfac954d48..7a7680c45a0b41 100644 --- a/packages/mui-material/src/manual-testing.md +++ b/packages/mui-material/src/manual-testing.md @@ -102,8 +102,8 @@ Run the rows matching what you touched, for the component you touched. - [ ] 🔁 **1.1.1 Non-text Content** — the screen reader tells the user that the chip can be deleted. Expected result from the source: it does not. To fix it, add a description with `aria-describedby`. - [ ] 🔁 **1.3.1 Info and Relationships** — each chip announces the correct role, and a list of chips is announced as a list. - [ ] 🔁 **1.4.1 Use of Color** — the meaning and the state of each chip stay clear without color. -- [ ] 🔁 **1.4.3 Contrast (Minimum)** — each label is at least `4.5:1` at rest, on hover, and on focus. `info` and `warning` fail. On an `outlined` chip, all focused labels except `secondary` fail, and the hovered `primary` label fails. The letter avatar and the disabled delete-only label fail. -- [ ] 🔁 **1.4.4 Resize Text** — the full label stays visible at 200% page zoom. +- [ ] 🔁 **1.4.3 Contrast (Minimum)** — each label is at least `4.5:1` at rest, on hover, and on focus. `info` and `warning` fail. On an `outlined` chip, all focused labels except `secondary` fail, and the hovered `primary` label fails. +- [ ] 🔍 **1.4.4 Resize Text** — the full label stays visible at 200% page zoom. - [ ] 🔁 **1.4.10 Reflow** — the full label stays visible. A long label fails with the default styles. - [ ] 🔁 **1.4.11 Non-text Contrast** — the delete icon and the focus indicator are at least `3:1`. The `outlined` border does not need `3:1`, because the label identifies the chip. It is `1.88:1` (default) and `2.23:1` to `3.57:1` (palette). The default delete icon and focus indicator fail. - [ ] 🔁 **1.4.12 Text Spacing** — the full label stays visible. A long label fails with the default styles. @@ -112,8 +112,8 @@ Run the rows matching what you touched, for the component you touched. - [ ] 🔁 **2.4.4 Link Purpose (In Context)** — the destination of each link chip is clear. - [ ] 🔁 **2.4.6 Headings and Labels** — each label describes the item or the filter. - [ ] 🔁 **2.4.7 Focus Visible** — each focused chip shows a visible change. -- [ ] 🔁 **2.5.8 Target Size (Minimum)** — the delete icon is at least 24 by 24 CSS px. Or, a 24 px circle on its center touches no other target. The default icon is 16 by 16 px. -- [ ] 🔁 **4.1.2 Name, Role, Value** — each chip announces its label and "button". The disabled chip announces "disabled" and cannot be deleted. The disabled delete-only chip fails. +- [ ] 🔁 **2.5.8 Target Size (Minimum)** — the delete icon is at least 24 by 24 CSS px. Or, a 24 px circle on its center touches no other target. The default icon is 22 by 22 px on a `medium` chip, and 16 by 16 px on a `small` chip. +- [ ] 🔁 **4.1.2 Name, Role, Value** — each chip announces its label and "button". The disabled chip announces "disabled". The disabled delete-only chip fails. ## CircularProgress diff --git a/scripts/a11yScorecard/render.mjs b/scripts/a11yScorecard/render.mjs index a2667e21e8f42c..8633bfc068d1d5 100644 --- a/scripts/a11yScorecard/render.mjs +++ b/scripts/a11yScorecard/render.mjs @@ -238,7 +238,7 @@ export function renderDocsRollup(totals) { const headline = totals.doesNotSupport === 0 ? '**No component records a ❌ Does Not Support rating for any Level A or AA criterion.**' - : `**${totals.doesNotSupport} criteria record a ❌ Does Not Support rating in at least one component.**`; + : `**${totals.doesNotSupport} ${totals.doesNotSupport === 1 ? 'criterion records' : 'criteria record'} a ❌ Does Not Support rating in at least one component.**`; return [ headline, '', diff --git a/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js b/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js index 667b520c019e59..f337d4e98eb46f 100644 --- a/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js +++ b/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js @@ -4,9 +4,10 @@ import Avatar from '@mui/material/Avatar'; const noop = () => {}; -// Documented gaps: the letter avatar is 3.30:1, and a disabled delete-only chip -// is not exposed as disabled, so axe rates its faded label as an active control. -// The avatar has two letters: axe marks one-letter text as incomplete, not as a fail. +// Documented gap: a disabled delete-only chip has no `aria-disabled`, so axe +// rates its faded label as an active control (4.1.2). +// The avatar chip records that the letter avatar passes `color-contrast`. +// The avatar has two letters: axe marks one-letter text as incomplete, not as a pass. export default function ChipA11yKnownGaps() { return ( From e9c24ecf00752dca9fe65e128f0cf216e49abe4c Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 11:12:45 +0100 Subject: [PATCH 08/12] removed notion of automated zoom test --- packages/mui-material/src/Chip/accessibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mui-material/src/Chip/accessibility.md b/packages/mui-material/src/Chip/accessibility.md index 11b98d8e89bfda..8fc3d48a0a6e10 100644 --- a/packages/mui-material/src/Chip/accessibility.md +++ b/packages/mui-material/src/Chip/accessibility.md @@ -67,7 +67,7 @@ Rated against WCAG 2.2 Level A and AA. See the [reports legend](../accessibility -- Under 200% page zoom, the chip, its container, and the label scale together, so a label that fits at 100% still fits. Page zoom decides the 1.4.4 rating (WCAG technique G142). The automated page-zoom check comes with the layout suite change in #49550, so this report confirms it with a manual step until then. +- Under 200% page zoom, the chip, its container, and the label scale together, so a label that fits at 100% still fits. Page zoom decides the 1.4.4 rating (WCAG technique G142). A manual step confirms it. - Under text-only resize, the label grows but a px-wide container does not. The label does not wrap, so it ends with an ellipsis. In the `ChipA11yLongLabel` fixture, a label fits its 240 px container at 100% (177 px). At a 200% text size, 219 px of the 331 px label is visible. A Playwright test confirms this. - To make long labels safe under text-only resize, let the label wrap with `height: 'auto'` on the chip, and `display: 'block'` and `whiteSpace: 'normal'` on the label, as the MultilineChips demo does. From 763c39cfadabeafb76d608ec56c1c234762e3f70 Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 11:13:33 +0100 Subject: [PATCH 09/12] removed avatarchip from known gaps --- test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js b/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js index f337d4e98eb46f..d8485151b2a2ab 100644 --- a/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js +++ b/test/regressions/a11y/fixtures/chips/ChipA11yKnownGaps.js @@ -1,17 +1,13 @@ import Stack from '@mui/material/Stack'; import Chip from '@mui/material/Chip'; -import Avatar from '@mui/material/Avatar'; const noop = () => {}; // Documented gap: a disabled delete-only chip has no `aria-disabled`, so axe // rates its faded label as an active control (4.1.2). -// The avatar chip records that the letter avatar passes `color-contrast`. -// The avatar has two letters: axe marks one-letter text as incomplete, not as a pass. export default function ChipA11yKnownGaps() { return ( - MB} label="With avatar" onDelete={noop} /> ); From 3b64ed7b0c5ca0cc26cd9c4745ef467e663e48b1 Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 11:15:07 +0100 Subject: [PATCH 10/12] added a tripwire fallback --- test/regressions/index.test.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/regressions/index.test.js b/test/regressions/index.test.js index c3b0a2e1f44954..f98da5bfd42bac 100644 --- a/test/regressions/index.test.js +++ b/test/regressions/index.test.js @@ -586,12 +586,17 @@ async function main() { ]) { // eslint-disable-next-line no-await-in-loop const style = await page.addStyleTag({ content: css }); - // eslint-disable-next-line no-await-in-loop - if (!(await truncated(page, 0))) { - throw new Error(`Chip label no longer truncates with ${css}; the gap may be fixed`); + // Remove the style also when the check throws. The page is pooled, and + // the style would change the tests that use the page later. + try { + // eslint-disable-next-line no-await-in-loop + if (!(await truncated(page, 0))) { + throw new Error(`Chip label no longer truncates with ${css}; the gap may be fixed`); + } + } finally { + // eslint-disable-next-line no-await-in-loop + await style.evaluate((node) => node.remove()); } - // eslint-disable-next-line no-await-in-loop - await style.evaluate((node) => node.remove()); } }); From 02dea7ef113727cbae12ba64305faf0d4c527e92 Mon Sep 17 00:00:00 2001 From: Michel Engelen <32863416+michelengelen@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:03:28 +0100 Subject: [PATCH 11/12] Apply suggestion from @LukasTy Co-authored-by: Lukas Tyla Signed-off-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com> --- packages/mui-material/src/Chip/accessibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mui-material/src/Chip/accessibility.md b/packages/mui-material/src/Chip/accessibility.md index 8fc3d48a0a6e10..0a0d365e27c09d 100644 --- a/packages/mui-material/src/Chip/accessibility.md +++ b/packages/mui-material/src/Chip/accessibility.md @@ -259,7 +259,7 @@ Tested by: unit `Chip.test.js` - Palette `filled`: `contrastText` at `70%` on `main`, `2.22:1` (`warning`) to `3.83:1` (`secondary`). - Palette `outlined`: `main` at `70%`, `2.23:1` to `3.57:1`. - A unit test confirms that the default delete icon is less than `3:1`. -- On keyboard focus, the chip background gets darker. The focused `default` fill is `1.61:1` against the page. On an `outlined` chip, the focus tint is about `1.14:1` to `1.21:1` against the page. +- On keyboard focus, the chip background gets darker. The focused `default` fill is `1.61:1` against the page. On an `outlined` chip, the focus tint against the page is `1.32:1` for `default`, and about `1.14:1` to `1.21:1` for the palette colors. - The rating is Does Not Support, because most of the functionality fails: the delete icon fails in 8 of the 14 combinations, including both `default` ones, and the default focus indicator fails. - The `outlined` border is `grey[400]` (`1.88:1` against white), or `main` at `70%` (`2.23:1` to `3.57:1`). The label identifies the chip, so the border does not need `3:1`. - With `focusVisible: true` on the theme, keyboard focus draws the theme outline ring instead. A Playwright test confirms the ring. From b8cb918de710e7008dcaf0b76d33a1952d90a892 Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 27 Nov 2026 12:07:22 +0100 Subject: [PATCH 12/12] added Does not support column --- .../accessibility/accessibility.md | 42 +++++++++---------- .../accessibility/scorecard.json | 4 +- .../mui-material/src/Chip/accessibility.json | 3 -- .../mui-material/src/Chip/accessibility.md | 38 ++++++++--------- packages/mui-material/src/manual-testing.md | 19 ++++----- scripts/a11yScorecard/render.mjs | 6 +-- test/regressions/a11y/criteriaSuites.mjs | 8 +--- 7 files changed, 54 insertions(+), 66 deletions(-) diff --git a/docs/data/material/getting-started/accessibility/accessibility.md b/docs/data/material/getting-started/accessibility/accessibility.md index e8af03a65e6de5..41508bf04126bc 100644 --- a/docs/data/material/getting-started/accessibility/accessibility.md +++ b/docs/data/material/getting-started/accessibility/accessibility.md @@ -35,26 +35,26 @@ Each row counts only the criteria that **apply** to that component; criteria tha -| Component | Level A | Level AA | Rated | ✅ Supports | ⚠️ Partially Supports | Verified | Automated | -| :------------------------------------------------------------------------------------------------------------------------------- | ------: | -------: | ----: | ----------: | --------------------: | -------: | --------: | -| [Accordion](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Accordion/accessibility.md) | 11 | 8 | 19 | 19 | 0 | 16/19 | 9 | -| [AccordionSummary](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/AccordionSummary/accessibility.md) | 13 | 11 | 24 | 23 | 1 | 21/24 | 11 | -| [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md) | 5 | 6 | 11 | 9 | 2 | 7/11 | 3 | -| [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) | 16 | 12 | 28 | 23 | 5 | 19/28 | 10 | -| [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 22/25 | 11 | -| [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | 13 | 11 | 24 | 16 | 7 | 15/24 | 4 | -| [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 6/11 | 1 | -| [Fab](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Fab/accessibility.md) | 14 | 11 | 25 | 21 | 4 | 19/25 | 9 | -| [FormLabel](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/FormLabel/accessibility.md) | 7 | 6 | 13 | 11 | 2 | 10/13 | 4 | -| [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) | 15 | 12 | 27 | 22 | 5 | 18/27 | 9 | -| [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 6/11 | 1 | -| [Link](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Link/accessibility.md) | 13 | 11 | 24 | 22 | 2 | 18/24 | 10 | -| [Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 23/25 | 11 | -| [RadioGroup](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/RadioGroup/accessibility.md) | 6 | 1 | 7 | 7 | 0 | 4/7 | 2 | -| [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 23/25 | 11 | -| [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md) | 14 | 14 | 28 | 25 | 3 | 24/28 | 12 | -| [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | 13 | 11 | 24 | 21 | 3 | 22/24 | 11 | -| [ToggleButtonGroup](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButtonGroup/accessibility.md) | 2 | 2 | 4 | 4 | 0 | 3/4 | 1 | +| Component | Level A | Level AA | Rated | ✅ Supports | ⚠️ Partially Supports | ❌ Does Not Support | Verified | Automated | +| :------------------------------------------------------------------------------------------------------------------------------- | ------: | -------: | ----: | ----------: | --------------------: | ------------------: | -------: | --------: | +| [Accordion](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Accordion/accessibility.md) | 11 | 8 | 19 | 19 | 0 | 0 | 16/19 | 9 | +| [AccordionSummary](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/AccordionSummary/accessibility.md) | 13 | 11 | 24 | 23 | 1 | 0 | 21/24 | 11 | +| [Avatar](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Avatar/accessibility.md) | 5 | 6 | 11 | 9 | 2 | 0 | 7/11 | 3 | +| [Button](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Button/accessibility.md) | 16 | 12 | 28 | 23 | 5 | 0 | 19/28 | 10 | +| [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 0 | 22/25 | 11 | +| [Chip](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Chip/accessibility.md) | 13 | 11 | 24 | 16 | 7 | 1 | 15/24 | 5 | +| [CircularProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CircularProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 0 | 6/11 | 1 | +| [Fab](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Fab/accessibility.md) | 14 | 11 | 25 | 21 | 4 | 0 | 19/25 | 9 | +| [FormLabel](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/FormLabel/accessibility.md) | 7 | 6 | 13 | 11 | 2 | 0 | 10/13 | 4 | +| [IconButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/IconButton/accessibility.md) | 15 | 12 | 27 | 22 | 5 | 0 | 18/27 | 9 | +| [LinearProgress](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/LinearProgress/accessibility.md) | 6 | 5 | 11 | 8 | 3 | 0 | 6/11 | 1 | +| [Link](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Link/accessibility.md) | 13 | 11 | 24 | 22 | 2 | 0 | 18/24 | 10 | +| [Radio](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Radio/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 0 | 23/25 | 11 | +| [RadioGroup](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/RadioGroup/accessibility.md) | 6 | 1 | 7 | 7 | 0 | 0 | 4/7 | 2 | +| [Switch](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Switch/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 0 | 23/25 | 11 | +| [TextField](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/TextField/accessibility.md) | 14 | 14 | 28 | 25 | 3 | 0 | 24/28 | 12 | +| [ToggleButton](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButton/accessibility.md) | 13 | 11 | 24 | 21 | 3 | 0 | 22/24 | 11 | +| [ToggleButtonGroup](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/ToggleButtonGroup/accessibility.md) | 2 | 2 | 4 | 4 | 0 | 0 | 3/4 | 1 | @@ -85,7 +85,7 @@ An application built with Material UI is not automatically accessible. Material ## Known gaps -Each ⚠️ rating comes from one of the issues below. Some of them can be fixed through the theme today. +Each ⚠️ and ❌ rating comes from one of the issues below. Some of them can be fixed through the theme today. diff --git a/docs/data/material/getting-started/accessibility/scorecard.json b/docs/data/material/getting-started/accessibility/scorecard.json index cb5c768f1adee8..a82e90da465be3 100644 --- a/docs/data/material/getting-started/accessibility/scorecard.json +++ b/docs/data/material/getting-started/accessibility/scorecard.json @@ -1543,7 +1543,7 @@ "level": "AA", "conformance": "Supports", "responsibility": "Shared", - "group": "Manual", + "group": "Automated", "flagged": false }, { @@ -1708,7 +1708,7 @@ "partiallySupports": 7, "doesNotSupport": 1, "verified": 15, - "automated": 4 + "automated": 5 } }, { diff --git a/packages/mui-material/src/Chip/accessibility.json b/packages/mui-material/src/Chip/accessibility.json index 8e6bdde04df4ac..93fbd2df139c5b 100644 --- a/packages/mui-material/src/Chip/accessibility.json +++ b/packages/mui-material/src/Chip/accessibility.json @@ -16,9 +16,6 @@ "1.4.3": { "responsibility": "Component" }, - "1.4.4": { - "group": "Manual" - }, "1.4.11": { "conformance": "Does Not Support" }, diff --git a/packages/mui-material/src/Chip/accessibility.md b/packages/mui-material/src/Chip/accessibility.md index 0a0d365e27c09d..678ed53c9d31f2 100644 --- a/packages/mui-material/src/Chip/accessibility.md +++ b/packages/mui-material/src/Chip/accessibility.md @@ -61,26 +61,6 @@ Rated against WCAG 2.2 Level A and AA. See the [reports legend](../accessibility **Pass:** no instruction refers to a chip by color or position alone. -#### 1.4.4 Resize Text · AA - -`✅ Supports` · `◐ Shared` - - - -- Under 200% page zoom, the chip, its container, and the label scale together, so a label that fits at 100% still fits. Page zoom decides the 1.4.4 rating (WCAG technique G142). A manual step confirms it. -- Under text-only resize, the label grows but a px-wide container does not. The label does not wrap, so it ends with an ellipsis. In the `ChipA11yLongLabel` fixture, a label fits its 240 px container at 100% (177 px). At a 200% text size, 219 px of the 331 px label is visible. A Playwright test confirms this. -- To make long labels safe under text-only resize, let the label wrap with `height: 'auto'` on the chip, and `display: 'block'` and `whiteSpace: 'normal'` on the label, as the MultilineChips demo does. - -**Manual testing steps** - -1. Render a chip with a label that just fits its container. -2. Set the browser zoom to 200%. -3. Make sure that the full label stays visible. - - - -**Pass:** the full label stays visible at 200% page zoom. - #### 1.4.5 Images of Text · AA `✅ Supports` · `○ Author` @@ -442,6 +422,24 @@ Tested by: unit `Chip.test.js` · axe-core `aria-allowed-attr` ✅, `aria-comman ### ⚙️ Automated +#### 1.4.4 Resize Text · AA + +`✅ Supports` · `◐ Shared` + +Tested by: Playwright + + + +- Under 200% page zoom, the chip, its container, and the label scale together, so a label that fits at 100% still fits. A Playwright test confirms this on the ChipsArray demo. Page zoom decides the 1.4.4 rating (WCAG technique G142). +- The page zoom check and the 1.4.10 reflow check cover 1.4.4 together. The page zoom viewport (500 × 350 px) is wider than the 320 px reflow viewport. So the page zoom check adds the clipping check, and the reflow check covers the narrow width. +- Another Playwright test confirms that the ChipsArray demo, with short labels, survives a 200% text-only resize. +- Under text-only resize, the label grows but a px-wide container does not. The label does not wrap, so it ends with an ellipsis. In the `ChipA11yLongLabel` fixture, a label fits its 240 px container at 100% (177 px). At a 200% text size, 219 px of the 331 px label is visible. A Playwright test confirms this. +- To make long labels safe under text-only resize, let the label wrap with `height: 'auto'` on the chip, and `display: 'block'` and `whiteSpace: 'normal'` on the label, as the MultilineChips demo does. + + + +**Pass:** the full label stays visible at 200% page zoom. + #### 2.1.2 No Keyboard Trap · A `✅ Supports` · `● Component` diff --git a/packages/mui-material/src/manual-testing.md b/packages/mui-material/src/manual-testing.md index 652b3276512a1f..fc6be1a2c499a9 100644 --- a/packages/mui-material/src/manual-testing.md +++ b/packages/mui-material/src/manual-testing.md @@ -18,14 +18,14 @@ the component (○ Author). Run the rows matching what you touched, for the component you touched. -| If your change touches… | Re-check | -| :----------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | -| Styling, theme, or palette | 1.4.1 Use of Color; 1.4.3 Contrast (Minimum); 1.4.4 Resize Text; 1.4.5 Images of Text; 1.4.10 Reflow; 1.4.11 Non-text Contrast; 1.4.12 Text Spacing | -| DOM structure, roles, or ARIA | 1.1.1 Non-text Content; 1.3.1 Info and Relationships; 1.3.2 Meaningful Sequence; 4.1.2 Name, Role, Value; 4.1.3 Status Messages | -| Keyboard, focus, or pointer handling | 2.1.1 Keyboard; 2.4.3 Focus Order; 2.4.4 Link Purpose (In Context); 2.4.6 Headings and Labels; 2.4.7 Focus Visible; 2.5.8 Target Size (Minimum) | -| Labels, errors, or validation | 3.3.2 Labels or Instructions | -| Motion or timing | 2.2.2 Pause, Stop, Hide | -| Other | 2.3.1 Three Flashes or Below Threshold | +| If your change touches… | Re-check | +| :----------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------- | +| Styling, theme, or palette | 1.4.1 Use of Color; 1.4.3 Contrast (Minimum); 1.4.5 Images of Text; 1.4.10 Reflow; 1.4.11 Non-text Contrast; 1.4.12 Text Spacing | +| DOM structure, roles, or ARIA | 1.1.1 Non-text Content; 1.3.1 Info and Relationships; 1.3.2 Meaningful Sequence; 4.1.2 Name, Role, Value; 4.1.3 Status Messages | +| Keyboard, focus, or pointer handling | 2.1.1 Keyboard; 2.4.3 Focus Order; 2.4.4 Link Purpose (In Context); 2.4.6 Headings and Labels; 2.4.7 Focus Visible; 2.5.8 Target Size (Minimum) | +| Labels, errors, or validation | 3.3.2 Labels or Instructions | +| Motion or timing | 2.2.2 Pause, Stop, Hide | +| Other | 2.3.1 Three Flashes or Below Threshold | ## Accordion @@ -96,13 +96,12 @@ Run the rows matching what you touched, for the component you touched. ## Chip -15 checks · full procedures in [`Chip/accessibility.md`](./Chip/accessibility.md) +14 checks · full procedures in [`Chip/accessibility.md`](./Chip/accessibility.md) - [ ] 🔁 **1.1.1 Non-text Content** — the screen reader tells the user that the chip can be deleted. Expected result from the source: it does not. To fix it, add a description with `aria-describedby`. - [ ] 🔁 **1.3.1 Info and Relationships** — each chip announces the correct role, and a list of chips is announced as a list. - [ ] 🔁 **1.4.1 Use of Color** — the meaning and the state of each chip stay clear without color. - [ ] 🔁 **1.4.3 Contrast (Minimum)** — each label is at least `4.5:1` at rest, on hover, and on focus. `info` and `warning` fail. On an `outlined` chip, all focused labels except `secondary` fail, and the hovered `primary` label fails. -- [ ] 🔍 **1.4.4 Resize Text** — the full label stays visible at 200% page zoom. - [ ] 🔁 **1.4.10 Reflow** — the full label stays visible. A long label fails with the default styles. - [ ] 🔁 **1.4.11 Non-text Contrast** — the delete icon and the focus indicator are at least `3:1`. The `outlined` border does not need `3:1`, because the label identifies the chip. It is `1.88:1` (default) and `2.23:1` to `3.57:1` (palette). The default delete icon and focus indicator fail. - [ ] 🔁 **1.4.12 Text Spacing** — the full label stays visible. A long label fails with the default styles. diff --git a/scripts/a11yScorecard/render.mjs b/scripts/a11yScorecard/render.mjs index 8633bfc068d1d5..cd676d06c24cac 100644 --- a/scripts/a11yScorecard/render.mjs +++ b/scripts/a11yScorecard/render.mjs @@ -252,13 +252,13 @@ export function renderDocsRollup(totals) { */ export function renderDocsTable(reports) { const header = [ - '| Component | Level A | Level AA | Rated | ✅ Supports | ⚠️ Partially Supports | Verified | Automated |', - '| :-------- | ------: | -------: | ----: | ----------: | --------------------: | -------: | --------: |', + '| Component | Level A | Level AA | Rated | ✅ Supports | ⚠️ Partially Supports | ❌ Does Not Support | Verified | Automated |', + '| :-------- | ------: | -------: | ----: | ----------: | --------------------: | ------------------: | -------: | --------: |', ]; const rows = reports.map(({ component, summary }) => { const link = `[${component}](${REPORT_BASE}/${component}/accessibility.md)`; - return `| ${link} | ${summary.levelA} | ${summary.levelAA} | ${summary.rated} | ${summary.supports} | ${summary.partiallySupports} | ${summary.verified}/${summary.rated} | ${summary.automated} |`; + return `| ${link} | ${summary.levelA} | ${summary.levelAA} | ${summary.rated} | ${summary.supports} | ${summary.partiallySupports} | ${summary.doesNotSupport} | ${summary.verified}/${summary.rated} | ${summary.automated} |`; }); return [...header, ...rows].join('\n'); diff --git a/test/regressions/a11y/criteriaSuites.mjs b/test/regressions/a11y/criteriaSuites.mjs index 1a6c45203ac08a..5d0747320150c9 100644 --- a/test/regressions/a11y/criteriaSuites.mjs +++ b/test/regressions/a11y/criteriaSuites.mjs @@ -19,13 +19,7 @@ export const CSS_LAYOUT_SUITES = [ }, { component: 'Button', route: '/docs-components-buttons/BasicButtons' }, { component: 'Checkbox', route: '/docs-components-checkboxes/Checkboxes' }, - { - component: 'Chip', - route: '/docs-components-chips/ChipsArray', - // This suite tests 1.4.4 as text-only resize. The Chip report rates 1.4.4 on - // page zoom (G142), so it stays Manual until the page-zoom check in #49550. - skipCriteria: ['1.4.4'], - }, + { component: 'Chip', route: '/docs-components-chips/ChipsArray' }, { component: 'CircularProgress', route: '/docs-components-progress/CircularDeterminate',