Skip to content

AX: aria-hidden=false should be a synonym of undefined - #32044

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
hoffmanjoshua:eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined
Oct 9, 2024
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
hoffmanjoshua:eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined

Conversation

@hoffmanjoshua

@hoffmanjoshua hoffmanjoshua commented Aug 12, 2024 •

Copy link
Copy Markdown
Contributor

b365574

AX: aria-hidden=false should be a synonym of undefined
https://bugs.webkit.org/show_bug.cgi?id=267150
rdar://120557669

Reviewed by Tyler Wilcock.

Per spec changes (see w3c/aria#2090, we should treat `aria-hidden=false` as undefined.

This patch removes support for aria-hidden=false, updating places where we relied on the behaviors of isNodeARIAVisible
with the new behavior. For example, we need to check if a child node is focused before deciding whether to skip it if it is
aria-hidden (tested by accessibility/datetime/input-date-field-labels-and-value-changes.html).

Tests that explicitly validate aria-hidden false were removed, and a new test to check that we are ignoring this property
has been added.

* LayoutTests/accessibility/aria-hidden-false-ignored-expected.txt: Added.
* LayoutTests/accessibility/aria-hidden-false-ignored.html: Added.
* LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html: Removed.
* LayoutTests/accessibility/aria-hidden-negates-no-visibility.html: Removed.
* LayoutTests/accessibility/aria-hidden-subtree-expected.txt: Added.
* LayoutTests/accessibility/aria-hidden-subtree.html: Added.
* LayoutTests/accessibility/aria-modal-expected.txt:
* LayoutTests/accessibility/aria-modal.html:
* LayoutTests/accessibility/aria-visible-element-roles.html: Removed.
* LayoutTests/accessibility/datetime/input-date-field-labels-and-value-changes.html:
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::modalElementHasAccessibleContent):
(WebCore::AXObjectCache::isNodeVisible const):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::isNodeFocused):
(WebCore::isNodeAriaVisible): Deleted.
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::textUnderElement const):
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::defaultObjectInclusion const):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::addNodeOnlyChildren):

Canonical link: https://commits.webkit.org/284905@main

53b1903

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug   🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2   🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@hoffmanjoshua hoffmanjoshua self-assigned this Aug 12, 2024
@hoffmanjoshua hoffmanjoshua added the Accessibility For bugs related to accessibility. label Aug 12, 2024
Comment thread Source/WebCore/accessibility/AXObjectCache.cpp Outdated
Comment thread Source/WebCore/accessibility/AXObjectCache.cpp Outdated
Comment thread Source/WebCore/accessibility/AXObjectCache.cpp Outdated
Comment thread Source/WebCore/accessibility/AXObjectCache.cpp Outdated
@twilco

twilco commented Aug 12, 2024

Copy link
Copy Markdown
Contributor

AccessibilityRenderObject::addNodeOnlyChildren() has a comment that probably needs updating:

// Some elements don't have an associated render object, meaning they won't be picked up by a walk of the render tree.
// For example, nodes that are `aria-hidden="false"` and `hidden`, or elements with `display: contents`.
// This function will find and add these elements to the AX tree.
void AccessibilityRenderObject::addNodeOnlyChildren()

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 12, 2024
@hoffmanjoshua hoffmanjoshua removed the merging-blocked Applied to prevent a change from being merged label Aug 12, 2024
@hoffmanjoshua
hoffmanjoshua force-pushed the eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined branch from a6312ba to 0ca0121 Compare August 12, 2024 19:28
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 12, 2024
Comment thread Source/WebCore/accessibility/AXObjectCache.cpp Outdated
Comment thread Source/WebCore/accessibility/AXObjectCache.cpp Outdated
@hoffmanjoshua hoffmanjoshua removed the merging-blocked Applied to prevent a change from being merged label Aug 15, 2024
@hoffmanjoshua
hoffmanjoshua force-pushed the eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined branch from 0ca0121 to b3432d6 Compare August 15, 2024 17:53
@hoffmanjoshua
hoffmanjoshua force-pushed the eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined branch from b3432d6 to 60d612e Compare August 15, 2024 17:59
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 15, 2024
@twilco

twilco commented Sep 29, 2024 •

Copy link
Copy Markdown
Contributor

The reason aria-modal-in-aria-hidden.html fails on glib platforms only is due to this snippet in AXObjectCache::modalElementHasAccessibleContent:

#if USE(ATSPI)
                // When using ATSPI, an accessibility object with 'StaticText' role is ignored.
                // Its content is exposed by its parent.
                // Treat such elements as having accessible content.
                if (axObject->roleValue() == AccessibilityRole::StaticText)
                    return true;
#endif

This unconditionally returns true for any static text object, even if it is aria-hidden. One possible way to fix this would be to change the if-statement to this:

if (axObject->roleValue() == AccessibilityRole::StaticText && !axObject->isAXHidden())
    return true;

And update the comment to mention that despite wanting to include static text on ATSPI, we still don't want aria-hidden text.

Ideally we could use axObject->defaultObjectInclusion() != AccessibilityObjectInclusion::IgnoreObject instead of isAXHidden(), as defaultObjectInclusion() also accounts for inert and visibility:hidden. However, at the end of defaultObjectInclusion(), accessibilityPlatformIncludesObject() is called, and for ATSPI that returns IgnoreObject for static text, breaking the intention of this if-statement.

So I think we should also add another line to this comment with a FIXME that this might not properly respect inert or visibility, file a follow-up bug stating this issue, and link to that bug in the FIXME comment.

@hoffmanjoshua hoffmanjoshua removed the merging-blocked Applied to prevent a change from being merged label Oct 4, 2024
@hoffmanjoshua
hoffmanjoshua force-pushed the eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined branch from 60d612e to 510e937 Compare October 4, 2024 23:32
Comment thread Source/WebCore/accessibility/AXObjectCache.cpp Outdated
Comment thread Source/WebCore/accessibility/AXObjectCache.cpp Outdated
Comment thread Source/WebCore/accessibility/AccessibilityNodeObject.cpp Outdated
Comment thread Source/WebCore/accessibility/AccessibilityNodeObject.cpp Outdated
Comment thread Source/WebCore/accessibility/AccessibilityRenderObject.cpp Outdated
@hoffmanjoshua
hoffmanjoshua force-pushed the eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined branch from 510e937 to 812643b Compare October 8, 2024 23:42
Comment thread Source/WebCore/accessibility/AccessibilityObject.cpp Outdated
Comment thread Source/WebCore/accessibility/AccessibilityNodeObject.cpp Outdated
@hoffmanjoshua
hoffmanjoshua force-pushed the eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined branch from 812643b to 1a99342 Compare October 8, 2024 23:54
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 9, 2024
@hoffmanjoshua hoffmanjoshua removed the merging-blocked Applied to prevent a change from being merged label Oct 9, 2024
@hoffmanjoshua
hoffmanjoshua force-pushed the eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined branch from 1a99342 to 53b1903 Compare October 9, 2024 14:45
@hoffmanjoshua hoffmanjoshua added the merge-queue Applied to send a pull request to merge-queue label Oct 9, 2024
https://bugs.webkit.org/show_bug.cgi?id=267150
rdar://120557669

Reviewed by Tyler Wilcock.

Per spec changes (see w3c/aria#2090), we should treat `aria-hidden=false` as undefined.

This patch removes support for aria-hidden=false, updating places where we relied on the behaviors of isNodeARIAVisible
with the new behavior. For example, we need to check if a child node is focused before deciding whether to skip it if it is
aria-hidden (tested by accessibility/datetime/input-date-field-labels-and-value-changes.html).

Tests that explicitly validate aria-hidden false were removed, and a new test to check that we are ignoring this property
has been added.

* LayoutTests/accessibility/aria-hidden-false-ignored-expected.txt: Added.
* LayoutTests/accessibility/aria-hidden-false-ignored.html: Added.
* LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html: Removed.
* LayoutTests/accessibility/aria-hidden-negates-no-visibility.html: Removed.
* LayoutTests/accessibility/aria-hidden-subtree-expected.txt: Added.
* LayoutTests/accessibility/aria-hidden-subtree.html: Added.
* LayoutTests/accessibility/aria-modal-expected.txt:
* LayoutTests/accessibility/aria-modal.html:
* LayoutTests/accessibility/aria-visible-element-roles.html: Removed.
* LayoutTests/accessibility/datetime/input-date-field-labels-and-value-changes.html:
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::modalElementHasAccessibleContent):
(WebCore::AXObjectCache::isNodeVisible const):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::isNodeFocused):
(WebCore::isNodeAriaVisible): Deleted.
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::textUnderElement const):
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::defaultObjectInclusion const):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::addNodeOnlyChildren):

Canonical link: https://commits.webkit.org/284905@main
@webkit-commit-queue
webkit-commit-queue force-pushed the eng/AX-aria-hiddenfalse-should-be-a-synonym-of-undefined branch from 53b1903 to b365574 Compare October 9, 2024 17:56
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 284905@main (b365574): https://commits.webkit.org/284905@main

Reviewed commits have been landed. Closing PR #32044 and removing active labels.

@webkit-commit-queue
webkit-commit-queue merged commit b365574 into WebKit:main Oct 9, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accessibility For bugs related to accessibility.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants