ARIA attributes must be used as the role's specification describes

Some ARIA attributes are allowed only under conditions set by the role's specification. Use them only where those conditions hold, so the state a screen reader announces matches reality.

Rule IDaria-conditional-attr
ImpactSerious
Success criterion 4.1.2 Name, Role, Value · A
StandardsWCAG 2.0 · WCAG 2.1 · WCAG 2.2 · Section 508 · EN 301 549
Readabler fix Fixed automatically

Example

Before
<label>
  <input type="checkbox" aria-checked="true">
  Subscribe to the newsletter
</label>

The box looks unchecked, but some screen readers say “checked”, so users submit the wrong choice.

After
<label>
  <input type="checkbox" checked>
  Subscribe to the newsletter
</label>

Screen readers and the visual box agree: “Subscribe to the newsletter, checkbox, checked”.

Why it matters

ARIA states overrule what the browser knows about an element. When they contradict the element's real state, people using screen readers and braille displays are told one thing while the page does another. A newsletter box that reads “checked” but is empty leads to unwanted emails or a missed opt-in; a radio button that reads “not checked” after being selected makes users click again and again.

The same problem appears in data tables. Attributes such as aria-level or aria-expanded on a row only make sense in a tree grid, where rows can be nested and collapsed. In a plain table or grid, browsers may ignore them or screen readers may describe a hierarchy that does not exist, which misleads users about the structure of the data.

How to fix it

Let native elements report their own state, and use conditional attributes only where they apply.

Native checkboxes and radio buttons. Remove aria-checked. Use the checked attribute in HTML and the checked or indeterminate property in script:

<input type="radio" name="delivery" value="express" checked>
document.querySelector('#select-all').indeterminate = true;

If you must keep aria-checked for a legacy script, make sure it always matches the real state.

Rows in a table or grid. Remove aria-level, aria-expanded, aria-posinset and aria-setsize from rows that are not in a tree grid:

<tr>
  <td>Invoice 2041</td>
  <td>Paid</td>
</tr>

Rows really nest and expand. Then the container is a tree grid. Declare it, so the attributes become valid:

<table role="treegrid" aria-label="Project folders">
  <tr aria-level="1" aria-expanded="true">…</tr>
</table>

A tree grid needs full keyboard support, so only use it when users can expand and collapse rows.

Checklist

  1. Remove aria-checked from native checkboxes and radio buttons.
  2. Set the checked or indeterminate property in script instead.
  3. Use aria-level and aria-expanded on rows only inside a treegrid.
  4. Test that announced states match what is shown.

How the check works

The check inspects roles with conditional attributes. On native input type="checkbox" and type="radio", it fails when aria-checked differs from the element's real checked (or indeterminate) state. On rows, it fails when aria-level, aria-expanded, aria-posinset or aria-setsize are used inside a table or grid that is not a tree grid. Otherwise it passes.

Resources

Updated October 27, 2026