Sheath rule
a11y-no-abstract-roles
Abstract ARIA roles must not be used.
- Package
- Core
- Category
- Accessibility
- Default severity
- error by default
- Auto-fix
- Auto-fix available
. When concrete roles remain beside the abstract ones, the fix rewrites role in place and applies with a plain --fix; when every listed role is abstract, the fix removes the attribute and needs --dangerous
#Why
Abstract roles exist only to organize the WAI-ARIA role taxonomy, and the specification does not allow them in content. Applying one has no effect on assistive technologies.
#Examples
#Bad
<!-- Using abstract roles -->
<div role="command">Click me</div>
<div role="composite">Container</div>
<div role="input">Enter text</div>
<div role="landmark">Navigation area</div>
<div role="range">Slider</div>
<div role="widget">Interactive element</div>
<div role="window">Modal</div>
#Good
<!-- Use concrete roles instead -->
<div role="button">Click me</div>
<div role="listbox">Container</div>
<div role="textbox">Enter text</div>
<div role="navigation">Navigation area</div>
<div role="slider">Slider</div>
<div role="dialog">Modal</div>
<!-- Or use native HTML elements -->
<button>Click me</button>
<nav>Navigation area</nav>
<input type="range">
#Abstract Roles (Do Not Use)
Replace each abstract role with a concrete role that matches the element's behavior.
| Role | Use Instead |
|---|---|
command |
button, link, menuitem |
composite |
grid, listbox, menu, tablist, tree |
input |
checkbox, radio, textbox, slider |
landmark |
banner, main, navigation, region |
range |
progressbar, slider, spinbutton |
roletype |
Any concrete role |
section |
alert, article, region, status |
sectionhead |
columnheader, heading, rowheader, tab |
select |
listbox, menu, radiogroup, tree |
structure |
Use semantic HTML elements |
widget |
Any interactive role |
window |
dialog, alertdialog |
#References
- WAI-ARIA 1.2: Abstract Roles - Specification defining abstract role taxonomy
- MDN: ARIA Roles - Reference for all ARIA roles and usage
#Related Rules
- a11y-no-invalid-role - Valid ARIA roles only