Home / Knowledge Base / ARIA Roles Must Be Nested Within Proper Parent Elements

ARIA Roles Must Be Nested Within Proper Parent Elements

Using ARIA roles helps assistive technologies such as screen readers understand what elements on a webpage represent and how they relate to one another. ARIA roles do not add visual structure; instead, they define an accessibility structure that assistive technologies rely on to interpret and interact with content.

Many ARIA roles are not standalone. They are defined by the ARIA specification to work only when placed inside specific parent roles. When a role that requires a particular parent is used outside of that required context, assistive technologies may ignore the role entirely, expose it incorrectly, or fall back to generic text.

Because ARIA does not generate errors or warnings in the browser, these failures often go unnoticed. This is why it is essential to ensure ARIA roles are always used within their correct parent structures.

What “Required Parent Role” Means in ARIA

ARIA defines valid role hierarchies, often referred to as required context roles. These rules specify which parent roles must exist for a given role to be recognised correctly.

For example:

  • role="menuitem" requires a parent with role="menu" or role="menubar"
  • role="treeitem" requires a parent with role="tree"
  • role="listitem" requires a parent with role="list"

These requirements are defined in the ARIA specification, not inferred by assistive technologies. When they are violated:

  • Some screen readers ignore the role completely
  • Some announce the element as plain text
  • Others expose partial or inconsistent information

This means the element may visually appear correct but behave incorrectly—or unpredictably—for users relying on assistive technology.

WCAG Success Criteria

The following WCAG 2.1 success criteria explain why correct ARIA role usage and hierarchy matter.

1.3.1 Info and Relationships (Level A)

Information, structure, and relationships conveyed visually must also be available programmatically so assistive technologies can interpret them.

Example:
A list item using role="listitem" must be contained within a parent such as role="list". Without that relationship, the item is no longer announced as part of a set, breaking the intended structure.

This is the primary success criterion governing ARIA role relationships.

4.1.2 Name, Role, Value (Level A)

User interface components must expose their name, role, and state so assistive technologies can process them correctly.

Example:
A menu item using role="menuitem" must appear within a role="menu" or role="menubar". Without the correct parent, a screen reader cannot determine the item’s role within the interaction model.

This criterion supports 1.3.1 by ensuring roles are exposed accurately once relationships are valid.

Use Native HTML First

Before using ARIA roles, always check whether native HTML already provides the required semantics.

Native HTML elements automatically expose correct roles, states, and relationships to assistive technologies.

Examples of what not to do:

  • Do not add role="list" to <ul> or <ol>
  • Do not add role="listitem" to <li>
  • Do not use role="menu" for site navigation
  • Do not use ARIA to “fix” broken HTML

ARIA should only be used when native HTML cannot express the required structure or interaction.

What Are ARIA Roles and Relationships

ARIA roles define what an element is, while ARIA relationship attributes define how elements are connected. These serve different purposes and should not be conflated.

Structural Roles (Containment-Based)

These roles define widget structure and hierarchy and often have required parents:

  • menu / menuitem
  • tree / treeitem
  • list / listitem
  • listbox / option

These roles depend on correct nesting to function.

Referential Relationships (Attribute-Based)

These attributes reference other elements to provide context or control:

  • aria-labelledby – defines an accessible label
  • aria-describedby – provides additional description
  • aria-controls – indicates controlled content
  • aria-activedescendant – tracks active items in composite widgets
  • aria-owns – redefines parent-child relationships in the accessibility tree

These attributes do not replace structural containment.

Example: Correct Role Hierarchy and Labelling

<h2 id="menuHeading">Main Navigation</h2>
<div role="menu" aria-labelledby="menuHeading">
  <div role="menuitem">Home</div>
  <div role="menuitem">About</div>
</div>

Here:

  • role="menu" establishes the composite widget
  • role="menuitem" elements are correctly nested
  • aria-labelledby provides an accessible name for the menu

This allows screen readers to announce the menu as a grouped interactive component rather than unrelated elements.

How Screen Readers Behave When Hierarchies Are Broken

When required parent roles are missing, assistive technologies do not fail loudly. Instead, they fail silently.

For example:

<div role="menuitem">Settings</div>

In practice, screen readers often:

  • Announce this as plain text
  • Ignore menu semantics entirely
  • Provide no keyboard navigation expectations

The user may hear “Settings” without any indication that it is part of a menu or interactive set.

Common Relationship Attributes

ARIA provides several attributes for defining relationships between elements:

  • aria-activedescendant – identifies the active child in composite widgets
  • aria-controls – indicates controlled content
  • aria-describedby – links descriptive text
  • aria-flowto – defines alternate reading order
  • aria-labelledby – defines accessible names
  • aria-posinset / aria-setsize – provide position within a set

Caution with aria-owns
aria-owns alters the accessibility tree and should be used only when necessary. It is frequently misused and can introduce serious navigation issues if applied incorrectly.

How to Fix the Problem

To ensure correct ARIA role usage:

  • Review all elements with ARIA roles
  • Confirm required parent roles using the ARIA specification or Authoring Practices Guide
  • Ensure roles are nested correctly and consistently
  • Prefer native HTML semantics wherever possible
  • Use relationship attributes only when structure alone cannot express meaning
  • Test with screen readers to verify actual behaviour, not just syntax

Incorrect Example

<div role="menuitem">Settings</div>

Corrected Version

<div role="menu">
  <div role="menuitem">Settings</div>
</div>

The role hierarchy is now valid and can be interpreted correctly.

Who Is Affected

Incorrect ARIA role structures impact:

  • Screen reader users navigating composite or hierarchical widgets
  • Users with motor impairments relying on predictable keyboard behaviour
  • Developers and QA teams troubleshooting inconsistent accessibility output

Wrapping Up

ARIA roles are powerful, but they are strict. They work only when roles reflect real, logical hierarchies and follow the rules defined by the ARIA specification.

Using native HTML first, respecting required parent roles, and applying relationship attributes cautiously ensures assistive technologies can interpret content reliably.

ARIA does not make content accessible by itself; the correct structure does.

Want to test against all WCAG success criteria?

Stay compliant. Avoid fines. WebYes reviews your entire website so you don't have to worry.

Sign Up for Free Now