Elements with the role=text attribute do not have focusable descendents

Text groupings do not hide interactive elements from screen readers.

On this page

Impact

ScanGov impact ratings

About

Adding role=text around a text node split by markup enables VoiceOver to treat it as one phrase, but the element's focusable descendents will not be announced.

Risks

Keyboard users reach elements that screen readers cannot announce.

Why it's important

Ensures assistive technologies like screen readers can correctly interpret and announce page elements to users with disabilities.

User stories

As a screen reader user, I want ARIA attributes to be correctly implemented so that I can understand the purpose and state of interactive elements.

Code

Failing pattern:

<!-- Fail: role="text" is not a valid ARIA role -->
<span role="text">Important notice</span>

Passing pattern:

<!-- Pass: remove the invalid role -->
<span>Important notice</span>

Error

ScanGov messaging when a site fails a standard:

Failed: Elements with the role=text attribute do not have focusable descendents

Guidance

Indicators

On this page