AX: Exclude aria-hidden text from stitched accessibility text#59904
Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom Mar 11, 2026
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 4049a0d) Details
|
4049a0d to
0ae3161
Compare
Collaborator
|
EWS run on previous version of this PR (hash 0ae3161) Details |
0ae3161 to
0cddb59
Compare
Collaborator
|
EWS run on previous version of this PR (hash 0cddb59) Details |
hoffmanjoshua
approved these changes
Mar 5, 2026
0cddb59 to
99eae9e
Compare
Collaborator
|
EWS run on previous version of this PR (hash 99eae9e) Details |
99eae9e to
083f2c4
Compare
Collaborator
|
EWS run on current version of this PR (hash 083f2c4) Details |
https://bugs.webkit.org/show_bug.cgi?id=309167 rdar://171726246 Reviewed by Joshua Hoffman. When text stitching is enabled, text within aria-hidden="true" elements was incorrectly included in the stitched text output. For example, given <span>$45.79<span aria-hidden="true">/mo.</span> per month</span>, the stitched text included "/mo." when it should only expose "$45.79 per month". The root cause was that stringValue() computed stitched text using a contiguous range from first to last stitch group member, capturing all DOM text in between, including text from aria-hidden nodes. Fix this by: - Main thread: building text from consecutive runs of non-hidden members, flushing each run as a DOM range to preserve inter-element whitespace while skipping hidden content. - Isolated tree: iterating members individually and skipping hidden ones. - Filtering hidden members from bounding box computation, simpleRange() endpoints, and textMarkerRange() endpoints. To support isAXHidden() on both live and isolated trees, store IsARIAHidden (a local per-node property) in the isolated tree, then compute isAXHidden() on-the-fly via ancestor traversal in AXCoreObject. This avoids the need to dirty stitch groups when aria-hidden changes dynamically. Also fix duplicate stitch group members caused by multiple layout boxes sharing the same RenderText renderer (e.g. text split across lines). This was exposed by test hit-test-on-stitched-text.html due to the new AXIsolatedObject::stringValue implementation which explicitly visits each stitch-group member. Test: accessibility/aria-hidden-text-stitching.html * LayoutTests/accessibility/aria-hidden-text-stitching-expected.txt: Added. * LayoutTests/accessibility/aria-hidden-text-stitching.html: Added. * Source/WebCore/accessibility/AXCoreObject.cpp: (WebCore::AXCoreObject::isAXHidden const): * Source/WebCore/accessibility/AXCoreObject.h: (WebCore::AXCoreObject::isARIAHidden const): * Source/WebCore/accessibility/AXLogger.cpp: (WebCore::operator<<): * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::handleAttributeChange): * Source/WebCore/accessibility/AXUtilities.cpp: (WebCore::lastNonAriaHiddenNode): (WebCore::lastNode): Deleted. * Source/WebCore/accessibility/AXUtilities.h: * Source/WebCore/accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::stitchGroups const): (WebCore::AccessibilityNodeObject::stringValue const): * Source/WebCore/accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::simpleRange const): (WebCore::AccessibilityObject::cachedIsIgnored const): (WebCore::AccessibilityObject::isAXHidden const): Deleted. * Source/WebCore/accessibility/AccessibilityObject.h: * Source/WebCore/accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::boundingBoxRect const): * Source/WebCore/accessibility/AccessibilityScrollView.cpp: (WebCore::AccessibilityScrollView::isAXHidden const): Deleted. * Source/WebCore/accessibility/AccessibilityScrollView.h: * Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::relativeFrame const): (WebCore::AXIsolatedObject::stringValue const): * Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h: * Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateNodeProperties): (WebCore::convertToPropertyFlag): (WebCore::createIsolatedObjectData): * Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h: * Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm: (WebCore::AXIsolatedObject::textMarkerRange const): Canonical link: https://commits.webkit.org/309096@main
083f2c4 to
361a2d0
Compare
Collaborator
|
Committed 309096@main (361a2d0): https://commits.webkit.org/309096@main Reviewed commits have been landed. Closing PR #59904 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 ios-apple
361a2d0
083f2c4
🛠 win🧪 win-tests🧪 api-mac-debug