Rule
Redundant roles
role attributes should not repeat the element’s built-in role.
- Rule
redundant-role- Type
- Best practice, not a WCAG requirement. It runs when Best practices is switched on.
- Severity
- Minor
What it checks
The rule fails an explicit role that repeats an element's built-in role, such as role="navigation" on a <nav> or role="button" on a <button>. It covers lists, buttons, links, landmarks, tables, form controls, headings and a few others.
Some repeats do real work and pass: role="list" or role="listitem" where CSS removes the bullets, which some screen readers take as a sign the list is not a list; table roles where CSS has changed the table's display; and role="img" on an <img> showing an SVG file. Elsewhere a repeated role does nothing for assistive technology and only adds markup to maintain.
Example
Fails
<nav role="navigation" aria-label="Main">
<a href="/">Home</a>
</nav>
Passes
<ul role="list" style="list-style: none">
<li>Free delivery</li>
<li>Easy returns</li>
</ul>
The engine is tested against both examples.
How to fix it
Remove the role attribute, unless it is one of the cases above where it restores meaning that CSS took away.
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.