New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AX: align AccessibilityRole::Switch with ::Checkbox #18938
AX: align AccessibilityRole::Switch with ::Checkbox #18938
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you also confirm computedrole
with a new subtest in WPT?
https://github.com/web-platform-tests/wpt/blob/master/html-aam/roles.html
Oh the tests PR is already in. Commented there. |
if (isCheckboxOrRadio() || isSwitch()) | ||
return checkboxOrRadioRect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose checkboxOrRadioRect()
is to unify the rect of the control with the rect of its associated label. But right now this only works with native <label for="id-of-control">Foo label</label>
, or containing labels:
<label>
Foo bar label for switch
<div role="switch"></div>
</label>
But I'm wondering if either of these methods of pairing labels are "allowed" or recommended patterns for a role="switch"
? Certainly for <input type=checkbox switch>
, but role="switch"
I'm less confident in.
@cookiecrook what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, but the logic here also does this for <label><span role=checkbox></span></label>
, right? Perhaps it shouldn't be using isCheckboxOrRadio()
to begin with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right, it would behave that way for role=checkbox, but arguably shouldn't. Let's remove this part and we'll address it separately later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes label for/id should only work on native inputs, not ARIA controls.
@cookiecrook this PR is mainly to align |
Update here:
|
It would be great to add a testcase to One place there will be a behavior difference is in inspector. Please add a |
8b8ad41
to
c0555f0
Compare
This comment was marked as outdated.
This comment was marked as outdated.
@twilco the changes I made to And interaction regions is a visionOS-specific fix it seems. @etiennesegonzac helpfully provided the test expectations there (that EWS will ignore, but hopefully that's good enough for everyone here to get r+). |
c0555f0
to
c4a86cb
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c4a86cb
to
179d374
Compare
EWS run on current version of this PR (hash 179d374) |
https://bugs.webkit.org/show_bug.cgi?id=263008 rdar://116805287 Reviewed by Tyler Wilcock. A switch should essentially be a checkbox except that it doesn't support the intermediate/mixed state. As such, this makes the following changes: - We make switch support the required attribute. - We make interaction regions support switches. * LayoutTests/accessibility/aria-required-expected.txt: * LayoutTests/accessibility/aria-required.html: * LayoutTests/inspector/dom/getAccessibilityPropertiesForNode-expected.txt: * LayoutTests/inspector/dom/getAccessibilityPropertiesForNode.html: * LayoutTests/interaction-region/aria-roles-expected.txt: * LayoutTests/interaction-region/aria-roles.html: * LayoutTests/platform/gtk/inspector/dom/getAccessibilityPropertiesForNode-expected.txt: * Source/WebCore/accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::supportsRequiredAttribute const): * Source/WebCore/page/InteractionRegion.cpp: (WebCore::shouldAllowAccessibilityRoleAsPointerCursorReplacement): Canonical link: https://commits.webkit.org/269311@main
179d374
to
5ce55c6
Compare
Committed 269311@main (5ce55c6): https://commits.webkit.org/269311@main Reviewed commits have been landed. Closing PR #18938 and removing active labels. |
5ce55c6
179d374
π§ͺ wpe-wk2π§ͺ mac-AS-debug-wk2