Repository navigation
[web] Expose mixed tristate checkboxes as aria-checked="mixed" - #194586
auto-submit[bot] merged 4 commits into
Conversation
SemanticCheckable wrote aria-checked as "true" or "false" only, so a tristate Checkbox with value null reached screen readers as unchecked even though the framework sends CheckedState.mixed. Checkboxes now report "mixed" for that state. Radio buttons and switches keep true/false, since ARIA defines "mixed" for checkboxes only. Fixes flutter#194547
There was a problem hiding this comment.
Code Review
This pull request introduces support for rendering the mixed state of a tristate checkbox by setting the aria-checked attribute to "mixed" when appropriate. A review comment identifies an issue in the new test case where the isEnabled property of SemanticsFlags is incorrectly assigned a ui.Tristate value instead of a boolean.
flutter-zl
left a comment
There was a problem hiding this comment.
LGTM, thanks for the fix.
Verified end to end with a before/after demo built from the same app:
https://flutter-demo-80-before.web.app renders the tristate checkbox as
aria-checked="false", https://flutter-demo-80-after.web.app renders
aria-checked="mixed", and the switch and radios are unchanged between the two.
|
autosubmit label was removed for flutter/flutter/194586, because - The status or check suite ci.yaml validation has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/194586, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
On the web, a tristate
Checkboxwhose value isnullwas announced by screen readers as not checked.SemanticCheckablesetaria-checkedto"true"or"false"only, so theCheckedState.mixedthe framework sends for that state became"false".This sets
aria-checked="mixed"for checkboxes in the mixed state. Radio buttons and switches keep"true"/"false", because ARIA defines"mixed"for checkboxes only. The existingCheckablebehavior, which already handles"mixed", isn't reused here because it ignores the toggled state that switches rely on.Adds a test next to the existing checked and unchecked checkbox semantics tests.
Thanks to @jorgelrj for tracking down the cause in the issue; this implements the first fix suggested there.
Fixes #194547
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.