[aria-*] attributes match their roles

Accessibility attributes are only used where they are supported.

On this page

Impact

ScanGov impact ratings

About

Each ARIA role supports a specific subset of aria-* attributes. Mismatching these invalidates the aria-* attributes. [Learn how to match ARIA attributes to their roles](https://dequeuniversity.com/rules/axe/4.10/aria-allowed-attr).

Risks

Screen readers ignore attributes that don't match the element's role.

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-checked is not valid on a paragraph -->
<p aria-checked="true">Status: active</p>

Passing pattern:

<!-- Pass: aria-checked is valid on a checkbox role -->
<input type="checkbox" aria-checked="true">

Error

ScanGov messaging when a site fails a standard:

Failed: [aria-*] attributes match their roles

Guidance

Indicators

On this page