Conditional ARIA attributes
Last updated:
How to fix this issue?
Only add ARIA attributes when the element is in a state that requires them. The most common example is aria-expanded, which is only valid on elements that can open or close something:
aria-expanded on a button that controls a collapsible section
<button aria-expanded="false" aria-controls="menu">Open menu</button>
<ul id="menu" hidden>
<li>Item 1</li>
</ul>
aria-expanded on a plain link that does not control anything collapsible
<a href="/page" aria-expanded="false">Go to page</a>
Another example is aria-checked, which is only valid on checkboxes, radio buttons, and similar roles:
<div role="checkbox" aria-checked="true">Accept terms</div>
aria-checked on a div with no role that supports it
<div aria-checked="true">Some text</div>
Remove any ARIA attribute that does not apply to the current role or state of the element.
Why is this important?
Screen readers read ARIA attributes to describe the state of elements to users. An attribute used outside its valid context produces incorrect or confusing announcements. Users may be told an element is expanded, checked, or selected when it has no such meaning.
Follow the WAI-ARIA specification to check which attributes are valid for each role and under which conditions they apply.
More info:
Rule info
Standard
User impact
Serious impact Significantly hinders users with disabilities. Should be fixed as a high priority. Critical : blocks access entirely Serious : significantly hinders use Moderate : causes difficulty Minor : minimal disruptionFix complexity
High level of required technical expertise To resolve this issue, you need technical expertise in software engineering. Resolving this issue requires modifying the software code, for which you need a background in software engineering.Free Website Accessibility Audit