Rule
Allowed ARIA attributes
ARIA attributes must be supported by the element’s role.
- Rule
aria-allowed-attr- WCAG 2.2
- 4.1.2 Name, Role, Value (opens in a new tab) (Level A)
- Severity
- Minor
What it checks
Each ARIA role supports a set of states and properties, and WAI-ARIA says authors must use only those, apart from the global attributes any element may carry. The rule fails an element with a non-global ARIA attribute its role does not support, such as aria-selected on a link or aria-expanded on a heading. Browsers drop the attribute, so nothing reaches assistive technology, and if the element really has that state, a screen reader user never learns it.
Misspelt attribute names are left to valid ARIA values, aria-label and aria-labelledby to aria-label placement, and an unsupported state backed by a native attribute, such as readonly beside aria-readonly, to unreachable states. Elements whose role the engine does not model are not judged.
Example
Fails
<nav aria-label="Language">
<a href="/en/" aria-selected="true">English</a>
<a href="/cy/">Cymraeg</a>
</nav>
Passes
<nav aria-label="Language">
<a href="/en/" aria-current="true">English</a>
<a href="/cy/">Cymraeg</a>
</nav>
The engine is tested against both examples.
How to fix it
Use an attribute the role supports, such as aria-current in place of aria-selected on a link, or move the attribute to the element whose role supports it. If the element has no such state, remove the attribute.
Check your own pages
This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.