A1 Unticked, but aria-checked="true"
<label><input type="checkbox" aria-checked="true"> Send me updates</label>
Expected result: fail
aria-conditional-attrTest cases for the axe-core rule aria-conditional-attr (axe-core 4.14). The rule checks ARIA attributes that are only allowed under certain conditions. It looks at three things:
aria-checked on <input type="checkbox"> must match the checkbox's real state.<input type="radio">. The Deque page doesn't mention radios, but the rule checks them.aria-level, aria-expanded, aria-posinset and aria-setsize are only allowed on rows inside a treegrid.One thing to know up front: the rule doesn't fail every aria-checked on a native checkbox. It only fails when the value disagrees with the real state, at the moment axe runs.
Every example is live in the page, so you can run the axe extension straight over it. The expected results were checked by running axe-core 4.14.1 over this page. Look in both the axe issues list and the needs review list.
| Expected result | Cases |
|---|---|
| Fail | 11 |
| Flagged by a different rule instead | 5 |
| Passes, but broken (axe misses it) | 2 |
| Pass (valid control cases) | 7 |
| Changes after interaction | 2 |
The checkbox says one thing, aria-checked says another. Screen readers may announce either.
<label><input type="checkbox" aria-checked="true"> Send me updates</label>
Expected result: fail
<label><input type="checkbox" checked aria-checked="false"> Remember me</label>
Expected result: fail
A native checkbox is only mixed when its indeterminate property is set with JavaScript.
<label><input type="checkbox" aria-checked="mixed"> Select all</label>
Expected result: fail
Radio buttons get the same check, but they can't be mixed.
<fieldset>
<legend>Delivery</legend>
<label><input type="radio" name="b1" aria-checked="true"> Standard</label>
<label><input type="radio" name="b1"> Express</label>
</fieldset>
Expected result: fail
Control cases. These pass because aria-checked agrees with the real state. They're still redundant, and the Deque page recommends removing aria-checked from native checkboxes altogether. The interaction cases at the end show why.
<label><input type="checkbox" checked aria-checked="true"> I agree</label>
Expected result: pass (valid)
<label><input type="checkbox" aria-checked="false"> Add gift wrap</label>
Expected result: pass (valid)
The script below sets indeterminate on page load, so the states match.
<label><input type="checkbox" id="c3-input" aria-checked="mixed"> All toppings</label>
Expected result: pass (valid)
<fieldset>
<legend>Size</legend>
<label><input type="radio" name="c4" checked aria-checked="true"> Small</label>
<label><input type="radio" name="c4"> Large</label>
</fieldset>
Expected result: pass (valid)
The rule only checks native inputs. On a custom checkbox, aria-checked is the only state there is.
<div role="checkbox" tabindex="0" aria-checked="true">Subscribe</div>
Expected result: pass (valid)
aria-level, aria-expanded, aria-posinset and aria-setsize only make sense on rows in a treegrid. In a table or grid they do nothing.
| My downloads |
<table>
<tr aria-level="1"><td>My downloads</td></tr>
</table>
Expected result: fail
| 2025 invoices |
<table>
<tr aria-expanded="false"><td>2025 invoices</td></tr>
</table>
Expected result: fail
| Chapter one |
<table>
<tr aria-posinset="1" aria-setsize="3"><td>Chapter one</td></tr>
</table>
Expected result: fail
| Reports |
<table role="grid" aria-label="Files">
<tr aria-level="1"><td>Reports</td></tr>
</table>
Expected result: fail
<div role="grid" aria-label="Orders">
<div role="row" aria-expanded="true">
<div role="gridcell">Order 1042</div>
</div>
</div>
Expected result: fail
<div role="table" aria-label="Contents">
<div role="row" aria-level="2">
<div role="cell">Introduction</div>
</div>
</div>
Expected result: fail
The outer treegrid doesn't help. Axe looks at the nearest table, which is the inner one.
| Budget |
<div role="treegrid" aria-label="Projects">
<div role="row" aria-level="1">
<div role="gridcell">
<table>
<tr aria-level="2"><td>Budget</td></tr>
</table>
</div>
</div>
</div>
Expected result: fail
The outer row (inside the treegrid) passes. Only the inner one fails.
Control cases.
| Photos |
<table role="treegrid" aria-label="Folders">
<tr aria-level="1" aria-expanded="false">
<td role="gridcell">Photos</td>
</tr>
</table>
Expected result: pass (valid)
aria-selected and aria-rowindex aren't on the list, so this rule doesn't care about them.
| Invoice 7 |
<table>
<tr aria-selected="true" aria-rowindex="1"><td>Invoice 7</td></tr>
</table>
Expected result: pass (valid)
This rule doesn't flag these, but another one does.
This rule treats any unknown value as false, which happens to match.
<label><input type="checkbox" aria-checked="banana"> Fruit box</label>
Expected result: flagged by aria-valid-attr-value instead
This rule ignores an empty value.
<label><input type="checkbox" checked aria-checked=""> Newsletter</label>
Expected result: flagged by aria-valid-attr-value instead
This rule ignores case, so it matches.
<label><input type="checkbox" checked aria-checked="TRUE"> Terms</label>
Expected result: flagged by aria-allowed-attr instead
With no table, grid or treegrid around it, this rule has nothing to compare against.
<div role="row" aria-level="1">
<div role="cell">Orphan row</div>
</div>
Expected result: flagged by aria-required-parent instead
role="presentation" removes the table semantics, so the row isn't a row any more.
| Layout cell |
<table role="presentation">
<tr aria-level="1"><td>Layout cell</td></tr>
</table>
Expected result: flagged by aria-allowed-attr instead
Nothing in axe flags these.
The same mismatch as A1. But because the role is switch, not checkbox, this rule doesn't check it. Which state gets announced depends on the browser.
<label><input type="checkbox" role="switch" aria-checked="true"> Dark mode</label>
Expected result: passes, but it's broken (check manually)
Radios can't be mixed. The rule quietly treats mixed as false, which matches the unselected radio.
<fieldset>
<legend>Colour</legend>
<label><input type="radio" name="g2" aria-checked="mixed"> Red</label>
<label><input type="radio" name="g2"> Blue</label>
</fieldset>
Expected result: passes, but it's broken (check manually)
Axe only sees the page as it is when you run it. These pass on page load. Activate each button, then run axe again.
aria-checked="false" matches on load. Tick the checkbox and the native state changes, but aria-checked doesn't. This is the best argument for never putting aria-checked on a native checkbox.
<label><input type="checkbox" id="h1-input" aria-checked="false"> Email me a receipt</label>
On load: pass. After ticking: fail
Both radios match on load. Choose "Pick up" and both are now wrong: the first still says true and the second still says false.
<fieldset>
<legend>Collection</legend>
<label><input type="radio" name="h2" checked aria-checked="true"> Delivery</label>
<label><input type="radio" name="h2" id="h2-pickup" aria-checked="false"> Pick up</label>
</fieldset>
On load: pass. After choosing Pick up: fail