R I S K M O N I T O R

Loading

Intelligent Cybersecurity Check for vulnerabilities now

Correct Use of aria-roledescription Attribute

Rule ID: aria-roledescription
Ruleset: axe-core 4.10
User Impact: Serious
Guidelines: WCAG 2.1 (A), WCAG 2.0 (A), WCAG 2.2 (A), EN 301 549


How to Fix the Problem

The aria-roledescription attribute must only be used on elements that already have a valid, explicitly or implicitly supported ARIA role. This means the attribute should only be added to elements that either:

  • Already have a native semantic role (e.g., <button> has an implicit button role)

  • Have been assigned a valid ARIA role using the role attribute (e.g., <div role="combobox">)

Correct Usage Examples:

html
<img aria-roledescription="my image" src="foo.png" />
<button aria-roledescription="custom button">Click me</button>
<div role="combobox" aria-roledescription="filter options"></div>

Incorrect Usage Examples:

html
<p aria-roledescription="my paragraph">Some text</p>
<div aria-roledescription="custom div">Content</div>

To fix issues:

  • First, check whether the element has a meaningful role—either implicit (like <button>) or explicitly set (like role="navigation").

  • If the element has no role, either remove the aria-roledescription or add a valid role.

  • Ensure the aria-roledescription does not contradict the actual function of the role, and only customize it if truly necessary (for screen reader clarity).

Refer to the ARIA in HTML specification for allowed usage.


Why it Matters

Improper use of aria-roledescription can cause serious accessibility issues:

  • If used on an element with no valid role, screen readers and other assistive technologies may misinterpret or ignore the element entirely.

  • Misusing aria-roledescription can lead to semantic conflicts where the custom description does not align with the element’s role, resulting in user confusion or unusable interfaces for people relying on assistive tech.

  • In worst cases, this misuse can break accessibility for large sections of a page, making key content inaccessible.

Assistive technologies rely on consistent and predictable role assignments. Misapplying this attribute disrupts that consistency.


Rule Description

Ensures the aria-roledescription attribute is used only on elements that have a valid implicit or explicit ARIA role.


The Algorithm (in Simple Terms)

  1. Check if an element includes the aria-roledescription attribute.

  2. If yes, verify that the element has a valid role—either implicit (based on the tag) or explicit (via a role attribute).

  3. If no valid role is found, or if the attribute conflicts with the role, it fails the rule.

Leave A Comment