ARIA roles must be placed inside their required parent

Last updated:

How to place ARIA roles in their required parent?

Some ARIA roles are only valid inside a specific parent role. Place the element inside the correct parent, or add the required parent role.

Common roles and their required parents:

RoleRequired parent role(s)
listitemlist
optionlistbox
tabtablist
menuitemmenu or menubar
rowgrid, rowgroup, or treegrid
gridcellrow
treeitemgroup or tree
BAD:

listitem without a list parent

<div role="listitem">Item 1</div>
<div role="listitem">Item 2</div>
CORRECT:

listitem inside a list

<div role="list">
    <div role="listitem">Item 1</div>
    <div role="listitem">Item 2</div>
</div>
BAD:

menuitem without a menu parent

<div role="menuitem">Open</div>
<div role="menuitem">Save</div>
CORRECT:

menuitem inside a menu

<ul role="menu">
    <li role="menuitem">Open</li>
    <li role="menuitem">Save</li>
</ul>

Where possible, prefer native HTML elements over ARIA roles.

Why is this important?

ARIA roles have a fixed hierarchy. If the required parent role is missing, screen readers cannot interpret the relationship between HTML elements and may skip the element, announce it incorrectly, or fail to provide certain functionality.

More info:

WCAG 4.1.2 Name, Role, Value.

Rule info

Standard

WCAG A SC 1.3.1

Regulations

EN 301 549 RGAA EAA AODA

User impact

Fix complexity

Affects

Was this article helpful?

Checkout the ExcellentWebCheck services

ExcellentWebCheck's goal is to improve the online user experience. The tools of ExcellentWebCheck help to detect and improve usability problems on your website.