Skip to content

Commit

Permalink
AX: aria-hidden=false should be a synonym of undefined
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=277958
rdar://problem/133693990

Reviewed by NOBODY (OOPS!).

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-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::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):
  • Loading branch information
Joshua Hoffman committed Aug 12, 2024
1 parent 6a05886 commit 0ca0121
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 491 deletions.
11 changes: 11 additions & 0 deletions LayoutTests/accessibility/aria-hidden-false-ignored-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This test ensures that aria-hidden=false is treated like an undefined value.

PASS: !hiddenText === true
PASS: !invisibleText === true
PASS: !ariaHiddenText === true

PASS successfullyParsed is true

TEST COMPLETE

This text is hidden with aria-hidden
38 changes: 38 additions & 0 deletions LayoutTests/accessibility/aria-hidden-false-ignored.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/accessibility-helper.js"></script>
<script src="../resources/js-test.js"></script>
</head>
<body>

<div style="display: none">
<p id="hidden-text" aria-hidden="false">This text should be hidden</p>
</div>

<div style="visibility: hidden">
<p id="invisible-text" aria-hidden="false">This text should be invisible</p>
</div>

<div aria-hidden="true">
<p id="aria-hidden-text">This text is hidden with aria-hidden</p>
</div>

<script>
var output = "This test ensures that aria-hidden=false is treated like an undefined value.\n\n";

if (window.accessibilityController) {
var hiddenText = accessibilityController.accessibleElementById("hidden-text");
output += expect("!hiddenText", "true");
var invisibleText = accessibilityController.accessibleElementById("invisible-text");
output += expect("!invisibleText", "true");
var ariaHiddenText = accessibilityController.accessibleElementById("aria-hidden-text");
output += expect("!ariaHiddenText", "true");

debug(output);
finishJSTest();
}
</script>
</body>
</html>

152 changes: 0 additions & 152 deletions LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html

This file was deleted.

75 changes: 0 additions & 75 deletions LayoutTests/accessibility/aria-hidden-negates-no-visibility.html

This file was deleted.

2 changes: 1 addition & 1 deletion LayoutTests/accessibility/aria-modal-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Dialog is displaying
PASS backgroundAccessible() is false
Dialog is displaying and aria-hidden=true
PASS backgroundAccessible() is true
Dialog is displaying and aria-hidden=false
Dialog is displaying and removed aria-hidden
PASS backgroundAccessible() is false
Dialog is not displaying with opacity 0
PASS backgroundAccessible() is true
Expand Down
6 changes: 3 additions & 3 deletions LayoutTests/accessibility/aria-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ <h3 id="myDialog">Just an example.</h3>
debug("Dialog is displaying and aria-hidden=true")
shouldBeTrue("backgroundAccessible()");

// Set aria-hidden=false.
document.getElementById("box").setAttribute("aria-hidden", "false");
// Unset aria hidden.
document.getElementById("box").removeAttribute("aria-hidden");
await waitFor(() => {
return !backgroundAccessible();
});
debug("Dialog is displaying and aria-hidden=false");
debug("Dialog is displaying and removed aria-hidden");
shouldBeFalse("backgroundAccessible()");

// Set opacity to 0 which should make the dialog invisible.
Expand Down
Loading

0 comments on commit 0ca0121

Please sign in to comment.