aria-required-parent

Roles requiring a specific context role must be in that context

automaticWCAG 1.3.1 (A)confidence: mediumseverity: moderaterobust

Checks that roles with a documented "required context role" entry (listitem, option, tab, treeitem, row, cell, ...) have an ancestor or aria-owns owner with an acceptable context role.

Applies to. Applies to elements with an explicit, valid, non-abstract role that is also one of the roles with a documented, non-empty "required context role" entry (listitem, option, menuitem, menuitemcheckbox, menuitemradio, tab, treeitem, row, cell, gridcell, columnheader, rowheader, rowgroup). The element needs its explicit role, but its context may take its role from a custom element's ElementInternals (this.attachInternals().role), as a native context takes its tag's.

Expectation. The element has an ancestor (DOM containment) or owner (via that ancestor/owner's aria-owns) whose effective role is one of the acceptable context roles for this element's role.

What a finding reports.

  • role: the element's role.
  • requiredContextRoles: the roles one of which it must sit inside, or be owned by. Each item is a role name.

These data.details fields help to read and reproduce a finding. Apart from reasonCode and the few fields Output schema names as stable, they are not a stable contract: a field may be renamed or dropped in a minor release, so don’t build on them.

Examples

pass
<div role="tablist">
<div role="tab">Overview</div>
</div>

role="tab" requires an ancestor (or aria-owns owner) with role="tablist", and one is present.

fail
<nav role="tab"></nav>

role="tab" has no tablist ancestor or owner anywhere on the page.

View source