[webkit-changes] [WebKit/WebKit] 18e61b: AX: AXIsolatedObject::relativeFrame should try to ...
Tyler Wilcock
noreply at github.com
Wed Jan 29 10:49:38 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 18e61b9a78ee75505477966caafa0a440b48ce98
https://github.com/WebKit/WebKit/commit/18e61b9a78ee75505477966caafa0a440b48ce98
Author: Tyler Wilcock <tyler_w at apple.com>
Date: 2025-01-29 (Wed, 29 Jan 2025)
Changed paths:
A LayoutTests/accessibility/mac/clipped-radio-input-frame-expected.txt
A LayoutTests/accessibility/mac/clipped-radio-input-frame.html
M LayoutTests/platform/mac-wk1/TestExpectations
M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
Log Message:
-----------
AX: AXIsolatedObject::relativeFrame should try to use the frame of associated labels as a fallback for controls that have not been painted
https://bugs.webkit.org/show_bug.cgi?id=286581
rdar://143706179
Reviewed by Chris Fleizach.
A very common pattern in web development is to have a "sr-only" (screenreader only) CSS class, which uses CSS clipping
to prevent an element from being visually rendered but still available to assistive technologies. This causes problems
for us right now, as the clipping will prevent the element from being painted, which means we won't cache any bounds
for it during the accessibility paint (i.e. AccessibilityRegionContext). A popular online web store using this pattern
to represent radio buttons, and because we compute a frame that is way off-screen, VoiceOver cannot select these radio
buttons.
In a future patch, we probably want some more general solution for handling this type of clipped content — maybe
unconditionally not respecting clipping when doing an accessibility paint, or having some heuristic for respecting
clipping.
But for now, this commit detects the case where we couldn't compute a cached frame for a control, and computes a relative
frame based on the sum rects of any associated labels. This is strictly better than returning a position that is likely
completely incorrect. This also covers in the case where a control will be painted, but hasn't yet, while its labels
have been painted and can provide reasonable geometry to use in the meantime.
This patch adds another heuristic to AXIsolatedObject::relativeFrame, where if we can't compute a cached frame, we at
least prevent the x,y from being reported as negative, as chances are if an AT is requesting the bounds for something,
it is somewhere on screen.
* LayoutTests/accessibility/clipped-radio-input-frame-expected.txt: Added.
* LayoutTests/accessibility/clipped-radio-input-frame.html: Added.
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::relativeFrame const):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
Canonical link: https://commits.webkit.org/289513@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list