Requires landmarks to have unique names

Rule ID:
unique-landmark
Category:
Accessibility
Standards:
-
Fixable:
No

When the same type of landmark is present more than once in the same document each must be uniquely identifiable with a non-empty and unique name. For instance, if the document has two <nav> elements each of them need an accessible name to be distinguished from each other.

This could be as simple as aria-label="Primary" and aria-label="Secondary" or if they have headings associated with them aria-labelledby can reference the heading. The names should not include the name of the landmark as Assistive Technology (AT) typically reads out the landmark as well so aria-label="Primary navigation" would be read as "Primary navigation navigation".

The following elements / roles are considered landmarks:

Some exceptions apply:

If the landmark is only present at most once the name does not have to be set.

Rule details

Examples of incorrect code for this rule:

<nav>lorem ipsum</nav>
<nav>dolor sit amet</nav>
error: Landmarks must have a non-empty and unique accessible name (aria-label or aria-labelledby) (unique-landmark)
> 1 | <nav>lorem ipsum</nav>
    |  ^^^
  2 | <nav>dolor sit amet</nav>


error: Landmarks must have a non-empty and unique accessible name (aria-label or aria-labelledby) (unique-landmark)
  1 | <nav>lorem ipsum</nav>
> 2 | <nav>dolor sit amet</nav>
    |  ^^^


2 errors found.

Examples of correct code for this rule:

<nav aria-label="Primary">lorem ipsum</nav>
<h2 id="secondary-nav-heading">Secondary</h2>
<nav aria-labelledby="secondary-nav-heading">dolor sit amet</nav>

Version history