fix(web): a native checkbox, radio, or option reads its own state over a stale aria attribute
Merged
OK
1mo ago+95+95+01234567890123456789-4-4-0123456789
- Repro:
<input type="checkbox" checked aria-checked="false">. The reader tookaria-checkedafter the native read and let it override, so the node readchecked: false,isChecked()answered false, andtoBeCheckedfailed on a box the browser would submit as checked. The inverse markup (unchecked input,aria-checked="true") madetoBeCheckedpass. Same for<option selected aria-selected="false">. The agent's observation showed the same wrong state. - Playwright's
getCheckedandgetAriaSelected(roleUtils.ts) read.checkedfor an input checkbox or radio and.selectedfor an option, and consult ARIA only for roles without native state. The reader now does the same: ARIA fills in only when the element has no native checked or selected state, sodiv[role=checkbox],role=switch, androle=tabkeep reading their attribute. check()anduncheck()never used this reader for their skip decision, so only the read and assert layer changes.
if (checked === null) {
const ariaChecked = el.getAttribute('aria-checked');
if (ariaChecked !== null) checked = ariaChecked === 'true';
}
packages/web/src/in-page/read-semantics.ts:758. The new browser test packages/web/tests/integration/read-node-checked.test.ts compares every control's read against Playwright's isChecked().