landmark-role-name-present
Region and form roles must have an accessible name
Checks that an element given role="region" or role="form" has an accessible name, without which it is not exposed as a landmark.
Applies to. Applies to elements whose role attribute resolves to region or form (its first known, non-abstract token, in any case: role="foo region" counts, role="search region" is a search landmark), and that are included in the accessibility tree. A custom element whose ElementInternals give it one of those roles (this.attachInternals().role), with no role attribute naming another, is in scope too: that is its default role, and no other rule checks it.
Expectation. The element has a non-empty accessible name from aria-labelledby, aria-label or title. WAI-ARIA requires one ("Authors MUST give each element with role region a brief label", and the same for form), and without one the element is not exposed as a landmark at all, so the role the author asked for is lost. Reported at CANTTELL rather than FAIL: the requirement is WAI-ARIA's, not a WCAG Success Criterion's. Nothing false reaches assistive technology, which gets a plain container, so whether losing the landmark harms anyone depends on the page.
What a finding reports.
role: the role that needs a name,regionorform.
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
<div role="region" aria-labelledby="news-h"><h2 id="news-h">Latest news</h2>...</div>
The region is named by its visible heading, so it is exposed as a landmark called "Latest news".
<div role="region"><h2>Latest news</h2>...</div>
role="region" with no name: WAI-ARIA requires one, and without it the element is exposed as a plain container, not a landmark. Not a failure, since the requirement names no WCAG criterion; a person decides whether the lost landmark matters.
<section><h2>Latest news</h2>...</section>
No role asks for a landmark. An unnamed <section> is not meant to be one.
How to check
When this rule can’t decide, it reports cantTell and leaves the question to a person. Each question it can ask is listed here under its reason code, with the steps to answer it. A finding carries the same steps as howToCheck, in the scan’s language. See Output schema.
LANDMARK_ROLE_NAME_MISSING
- Inspect the element the report names and note its role (region or form).
- Look at the content it wraps and any visible heading at its start.
- Decide whether the area is important enough that users should be able to jump to it as a landmark.
- If so, check whether it is given a name, for example with aria-labelledby pointing at its heading.
Pass. The area does not need to be a landmark (and the role can be removed), or it is given a name that makes it one.
Fail. An area meant as a landmark has no name, so it is not exposed as one, which fails the WAI-ARIA requirement that region and form roles be labelled (best practice, ARIA13).