useAriaPropsForRole
Diagnostic Category: lint/a11y/useAriaPropsForRole
Since: v1.0.0
Sources:
Description
Section titled DescriptionEnforce that elements with ARIA roles must have all required ARIA attributes for that role.
Examples
Section titled ExamplesInvalid
Section titled Invalid<span role="checkbox"></span>
code-block.jsx:1:7 lint/a11y/useAriaPropsForRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The element with the checkbox ARIA role does not have the required ARIA attributes.
> 1 │ <span role=“checkbox”></span>
│ ^^^^^^^^^^^^^^^
2 │
ℹ Missing ARIA prop(s):
- aria-checked
<span role="heading"></span>
code-block.jsx:1:7 lint/a11y/useAriaPropsForRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The element with the heading ARIA role does not have the required ARIA attributes.
> 1 │ <span role=“heading”></span>
│ ^^^^^^^^^^^^^^
2 │
ℹ Missing ARIA prop(s):
- aria-level
Valid
Section titled Valid<span role="checkbox" aria-checked="true"></span>
<span role="heading" aria-level="1"></span>
Accessibility guidelines
Section titled Accessibility guidelinesResources
Section titled ResourcesHow to configure
Section titled How to configure{ "linter": { "rules": { "a11y": { "useAriaPropsForRole": "error" } } }}