Rampsight

All rules

ARIA

Some elements cannot carry an ARIA name

Why it matters

A generic element — a plain div or span with no role — is not allowed a name. Assistive technology ignores aria-label there, so the label you wrote is simply never read.

How to fix it

  1. Give the element a role that supports naming, or use a semantic element such as <section>, <nav> or a heading.
  2. If the label is only meant for sighted users, use visible text instead.
  3. Remove aria-label where the element is decorative.

In markup

Fails
<div aria-label="Latest news">Latest news</div>
Passes
<section aria-label="Latest news">Latest news</section>

The requirement behind it

This rule is one way of failing the following WCAG 2.2 success criteria. The W3C, which writes the standard, explains each of them:

Further reading

Deque University on aria-prohibited-attr (opens in new tab)

Deque maintains axe-core, the open-source engine our scanner runs. Their page documents the rule as the engine implements it.

Automated checks find failures a browser can prove. They cannot judge whether a caption is accurate, whether an alt text is useful, or whether a page can be operated end to end with a keyboard — those need a person.