ARIA attributes are used as specified for the element's role

Accessibility attributes are only used when the element's role allows them.

On this page

Impact

ScanGov impact ratings

About

Some ARIA attributes are only allowed on an element under certain conditions.

Risks

Screen readers ignore attributes used outside their allowed conditions.

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: aria-expanded on a non-expandable element -->
<p aria-expanded="true">Details</p>

Passing pattern:

<!-- Pass: aria-expanded on a button that controls a collapsible region -->
<button aria-expanded="true" aria-controls="details-panel">Details</button>
<div id="details-panel">...</div>

Error

ScanGov messaging when a site fails a standard:

Failed: ARIA attributes are used as specified for the element's role

Guidance

Indicators

On this page