1. Home
  2. :
  3. WCAG Guidelines
  4. :
  5. 4.1.1 Parsing – Level A
  6. :
  7. Are hierarchical relationships coded correctly?

Are hierarchical relationships coded correctly?

Goal

Ensure that the technology that reads our web markup can parse hierarchical relationships correctly.

Why this matters

Some HTML elements require hierarchical relationships. <li> tags must be nested in <ol> or <ul> tags, for example. If these relationships are not correctly coded, then the browser may be able to “guess” at the proper visual display, but assistive technology is more likely to balk or break.

Some ARIA roles also require hierarchical relationships. The role=”tab” attribute (often attached to unordered list items, because that’s a popular way to build tabs) must be nested in an element with a role=”tablist” attribute, otherwise it’s invalid as well.

How to implement

HTML elements that require specific hierarchical relationships include:

ARIA roles that require specific hierarchical relationships include:

  • ARIA: grid role and the element(s) with the row or rowgroup role it contains.
  • ARIA: table role and the element(s) with the row or rowgroup role it contains. (Reminder: tables should be built with <table> elements.)
  • ARIA: row role and the element(s) with the cell role, columnheader role, rowheader role or gridcell role it contains. (Reminder: tables should be built with <table> elements.)
  • ARIA: List role and the element(s) with the listitem role it contains. (Reminder: lists should be built with <ol> or <ul> elements.)
  • Tablist role and the element(s)with the ARIA: tab role it contains.

How to test

HTML validators should identify any of the HTML hierarchies that are invalid.

Until I identify a validator that definitely catches the ARIA relationships, you can manually check these by identifying places on the page where ARIA roles are being used, then confirming by inspecting the page that the correct hierarchies are being used.