aria-prohibited-attr

Ensures ARIA attributes are not prohibited for an element's role

Who might be affected
Screen Reader
Braille

Description

ARIA attributes are designed to convey important information to screen reader users, but ARIA attributes are supported differently by different HTML elements depending on their semantics. For example screen readers will ignore attributes like aria-label or aria-labelledby when implemented on elements like <div> or elements with role="presentation" since such elements should not have an accessible name. When using an ARIA attribute, it is essential to ensure it is set on a supported element. Otherwise, screen readers will not read the information or may read it in a misleading way

Quick Fixes

Dealing with such issues depends on the element type and the ARIA attribute that is set on it. To understand which ARIA attributes are allowed on which HTML elements or ARIA roles, see the Rules of ARIA attribute usage by HTML element table on the ARIA in HTML document. As a rule of thumb, ARIA attributes should match the semantics of the element they are set to. It would, for example, not make sense to add an attribute like aria-valuemin or aria-valuenow to an element like <table> or <li> since they don't return any value, so these attributes have no meaning in terms of semantics.

Fixing such an issue will usually require changing the semantics of the element or moving the ARIA attribute to a child or parent element with semantics that support it.

1<!-- div is a generic container,
2 it should not have a name.
3 Screen readers will not read its label -->
4
5<div aria-label="About">
6 <!-- [Content] -->
7 </div>
8
9
10<section aria-label="About">
11 <!-- [Content] -->
12 </section>
1<p aria-label="Today's news">
2 <!-- [Content] -->
3 </p>
4
5
6<article aria-label="Today's news">
7 <p>
8 <!-- [Content] -->
9 </p>
10 </article>

How Users Are Affected

When assistive technologies encounter an element with an ARIA attribute they do not support, they typically ignore this attribute, which may result in assistive technology users receiving partial, incorrect, or out-of-context information.

WCAG Success criteria

This issue might cause elements to fail one or more of the following Success criteria:
4.1.2 Name, Role, Value (A)