Disallow usage of redundant roles
- Rule ID:
- no-redundant-role
- Category:
- Accessibility
- Standards:
- ARIA in HTML
Some HTML5 elements have implicit WAI-ARIA roles defined by ARIA in HTML.
This rule disallows using the role attribute to set the role to same as the implied role.
Rule details
Examples of incorrect code for this rule:
<main role="main">
<ul>
<li role="listitem">Lorem ipsum</li>
</ul>
</main>
Examples of correct code for this rule:
<ul>
<li role="presentation">Lorem ipsum</li>
</ul>
Options
This rule takes an optional object:
{
"include": null,
"exclude": null
}
include
- type:
string[] | null - default:
null
If set, only roles listed in this array generate errors.
exclude
- type:
string[] | null - default:
null
If set, roles listed in this array are ignored.
Version history
- 10.11.0 - Added
includeandexcludeoptions.