Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions docs/data/material/components/checkboxes/checkboxes.a11y.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,70 @@
}
}
},
"FormGroupA11yStates": {
"rules": {
"aria-allowed-attr": {
"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"]
},
"duplicate-id-aria": {
"status": "pass",
"tags": ["wcag2a"]
},
"form-field-multiple-labels": {
"status": "pass",
"tags": ["wcag2a"]
},
"label": {
"status": "pass",
"tags": ["wcag2a"]
},
"nested-interactive": {
"status": "pass",
"tags": ["wcag2a"]
},
"target-size": {
"status": "pass",
"tags": ["wcag22aa"]
}
}
},
"IconCheckboxes": {
"rules": {
"aria-allowed-attr": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function FormControlLabelPosition() {
// @focus-start @padding 2
<FormControl component="fieldset">
<FormLabel component="legend">Label placement</FormLabel>
<FormGroup aria-label="position" row>
<FormGroup row>
<FormControlLabel
value="bottom"
control={<Checkbox />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function FormControlLabelPosition() {
// @focus-start @padding 2
<FormControl component="fieldset">
<FormLabel component="legend">Label placement</FormLabel>
<FormGroup aria-label="position" row>
<FormGroup row>
<FormControlLabel
value="bottom"
control={<Switch color="primary" />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Each row counts only the criteria that **apply** to that component; criteria tha
| [Checkbox](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Checkbox/accessibility.md) | 14 | 11 | 25 | 24 | 1 | 22/25 | 11 |
| [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 |
| [FormGroup](https://github.com/mui/material-ui/blob/master/packages/mui-material/src/FormGroup/accessibility.md) | 5 | 2 | 7 | 7 | 0 | 4/7 | 2 |
| [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 |
Expand Down
89 changes: 88 additions & 1 deletion docs/data/material/getting-started/accessibility/scorecard.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"standard": "WCAG 2.2 Level A and AA",
"componentCount": 17,
"componentCount": 18,
"totals": {
"rated": 32,
"supports": 23,
Expand Down Expand Up @@ -1838,6 +1838,93 @@
"automated": 9
}
},
{
"component": "FormGroup",
"counts": {
"supports": 7,
"partiallySupports": 0,
"doesNotSupport": 0,
"notApplicable": 48,
"flagged": 3,
"rated": 7
},
"gaps": [],
"criteria": [
{
"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": "Shared",
"group": "Manual",
"flagged": true
},
{
"number": "1.3.3",
"name": "Sensory Characteristics",
"level": "A",
"conformance": "Supports",
"responsibility": "Author",
"group": "Manual",
"flagged": false
},
{
"number": "1.4.10",
"name": "Reflow",
"level": "AA",
"conformance": "Supports",
"responsibility": "Shared",
"group": "Automated",
"flagged": false
},
{
"number": "2.4.3",
"name": "Focus Order",
"level": "A",
"conformance": "Supports",
"responsibility": "Shared",
"group": "Automated",
"flagged": false
},
{
"number": "2.4.6",
"name": "Headings and Labels",
"level": "AA",
"conformance": "Supports",
"responsibility": "Shared",
"group": "Manual",
"flagged": true
},
{
"number": "3.3.2",
"name": "Labels or Instructions",
"level": "A",
"conformance": "Supports",
"responsibility": "Shared",
"group": "Hybrid",
"flagged": true
}
],
"summary": {
"rated": 7,
"levelA": 5,
"levelAA": 2,
"supports": 7,
"partiallySupports": 0,
"doesNotSupport": 0,
"verified": 4,
"automated": 2
}
},
{
"component": "FormLabel",
"counts": {
Expand Down
11 changes: 11 additions & 0 deletions packages/mui-material/src/Checkbox/accessibility.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{
"axe": "docs/data/material/components/checkboxes/checkboxes.a11y.json",
"axeDemos": [
"CheckboxLabels",
"Checkboxes",
"CheckboxesGroup",
"ColorCheckboxes",
"ControlledCheckbox",
"CustomizedCheckbox",
"IconCheckboxes",
"IndeterminateCheckbox",
"SizeCheckboxes"
],
"criteria": { "2.5.8": { "responsibility": "Shared" }, "3.3.2": { "flagged": true } }
}
56 changes: 55 additions & 1 deletion packages/mui-material/src/FormGroup/FormGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, it, expect } from 'vitest';
import { createRenderer, screen } from '@mui/internal-test-utils';
import * as React from 'react';
import { createRenderer, screen, isJsdom } from '@mui/internal-test-utils';
import FormGroup, { formGroupClasses as classes } from '@mui/material/FormGroup';
import FormControl from '@mui/material/FormControl';
import describeConformance from '../../test/describeConformance';
Expand Down Expand Up @@ -42,4 +43,57 @@ describe('<FormGroup />', () => {
});
});
});

describe('accessibility', () => {
it('renders no role of its own', () => {
const { container } = render(
<FormGroup>
<input type="checkbox" aria-label="Cheese" />
</FormGroup>,
);

expect(container.firstChild).not.to.have.attribute('role');
expect(screen.queryByRole('group')).to.equal(null);
});
});

describe('WCAG 2.2 conformance', () => {
it('1.3.1 Info and Relationships: becomes a named group with role="group" and aria-labelledby', () => {
render(
<React.Fragment>
<span id="share">Share with</span>
<FormGroup role="group" aria-labelledby="share">
<input type="checkbox" aria-label="Team" />
</FormGroup>
</React.Fragment>,
);

expect(screen.getByRole('group')).toHaveAccessibleName('Share with');
});

// JSDOM has no layout
it.skipIf(isJsdom())(
'2.4.3 Focus Order: a row group shows its controls from left to right in tab order',
async () => {
const { user } = render(
<FormGroup row>
<input type="checkbox" aria-label="Email" />
<input type="checkbox" aria-label="Push" />
<input type="checkbox" aria-label="Text message" />
</FormGroup>,
);

let previousLeft = -Infinity;
for (const name of ['Email', 'Push', 'Text message']) {
// eslint-disable-next-line no-await-in-loop
await user.tab();
const checkbox = screen.getByRole('checkbox', { name });
expect(checkbox).toHaveFocus();
const { left } = checkbox.getBoundingClientRect();
expect(left).to.be.above(previousLeft);
previousLeft = left;
}
},
);
});
});
29 changes: 29 additions & 0 deletions packages/mui-material/src/FormGroup/accessibility.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"axe": "docs/data/material/components/checkboxes/checkboxes.a11y.json",
"axeDemos": ["FormGroupA11yStates"],
"criteria": {
"1.3.2": { "responsibility": "Shared", "flagged": true },
"2.4.6": { "group": "Manual", "flagged": true },
"3.3.2": { "flagged": true }
},
"notApplicable": [
"1.1.1",
"1.4.1",
"1.4.3",
"1.4.4",
"1.4.5",
"1.4.11",
"1.4.12",
"2.1.1",
"2.1.2",
"2.4.7",
"2.4.11",
"2.5.2",
"2.5.3",
"2.5.8",
"3.2.1",
"3.2.2",
"3.2.4",
"4.1.2"
]
}
Loading
Loading