aria-text
Rule Severity : Serious
Description
The aria-text rule ensures that elements with role="text" do not contain focusable or interactive descendants. The role="text" attribute instructs assistive technologies to read the element’s content as a single, continuous string of text rather than treating it as a generic container. However, if the element contains interactive children such as links or buttons, those children become inaccessible because the role="text" suppresses their interactive semantics.
This rule meets WCAG requirements by:
- Programmatic Role Accuracy (WCAG 4.1.2 Name, Role, Value): It ensures that ARIA roles accurately reflect the nature of the element, preventing a mismatch between the declared role and actual interactive content within.
- Preserving Information and Relationships (WCAG 1.3.1 Info and Relationships): It prevents content relationships, such as a link embedded within a paragraph, from being obscured by an incorrect role assignment.
To comply with this rule, use role="text" only on elements that contain purely static text with no interactive descendants.
Examples
This example shows a paragraph with role="text" containing an anchor link. The link becomes inaccessible to keyboard and screen reader users because role="text" suppresses the interactive semantics of the child element.
Removing role="text" keeps the link fully accessible and operable.
How to fix?
To fix violations of the aria-text rule, follow these steps:
-
Remove
role="text"from any element that contains interactive descendants such as links, buttons, or form inputs. -
If you need the content to be read as a continuous string, restructure the HTML so that all interactive elements are placed outside the
role="text"container. -
Use
role="text"only on elements containing purely static, non-interactive text where you specifically need to prevent assistive technologies from treating the container as a group.
Reference
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!