Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
AX: checkboxes don't respect
indeterminate
IDL attribute state
https://bugs.webkit.org/show_bug.cgi?id=231760 rdar://problem/84269311 Reviewed by Chris Fleizach. This patch features two improvements: 1. The `indeterminate` IDL attribute is respected when determining the AX value of native checkboxes 2. Indeterminate values for both native inputs and aria-checked="mixed" ARIA inputs are now properly exposed on iOS Prior to this patch, our determination of `isIndeterminate` was whether the AX object had an `indeterminate="true"` HTML attribute. However, this HTML attribute is non-standard and not used anywhere besides our AX code. This patch removes usage of it in favor of the correct indeterminate determination mechanisms. * LayoutTests/accessibility/aria-checked-mixed-value.html: Remove usage of `indeterminate` HTML attribute. * LayoutTests/accessibility/checkbox-mixed-value-expected.txt: * LayoutTests/accessibility/checkbox-mixed-value.html: Remove usage of `indeterminate` HTML attribute in favor of `indeterminate` IDL attribute. * LayoutTests/platform/ios/TestExpectations: Enable aria-checked-mixed-value.html and checkbox-mixed-value.html. * LayoutTests/platform/ios/accessibility/aria-checked-mixed-value-expected.txt: Added. * LayoutTests/platform/mac/accessibility/aria-checked-mixed-value-expected.txt: Deleted. * LayoutTests/accessibility/aria-checked-mixed-value-expected.txt: Updated. * Source/WebCore/accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::isIndeterminate const): (WebCore::AccessibilityNodeObject::checkboxOrRadioValue const): (WebCore::AccessibilityNodeObject::isNativeCheckboxOrRadio const): Deleted. * Source/WebCore/accessibility/AccessibilityNodeObject.h: * Source/WebCore/accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::checkboxOrRadioValue const): * Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateNodeProperties): Fix AXTrace typo. * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setIndeterminate): Send a value change notification to update the accessibility isolated tree cache, and to inform AX clients of the new value. * Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm: (WTR::AccessibilityUIElement::isIndeterminate const): Implement using the existing WebAccessibilityObjectWrapperIOS::accessibilityIsIndeterminate method. Canonical link: https://commits.webkit.org/258314@main
- Loading branch information
Showing
13 changed files
with
93 additions
and
131 deletions.
There are no files selected for viewing
26 changes: 10 additions & 16 deletions
26
LayoutTests/accessibility/aria-checked-mixed-value-expected.txt
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,32 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../resources/js-test-pre.js"></script> | ||
<script src="../resources/accessibility-helper.js"></script> | ||
<script src="../resources/js-test.js"></script> | ||
</head> | ||
<body id="body"> | ||
|
||
<div id="content"> | ||
<body> | ||
|
||
<div id="element1" role="radio" aria-checked="mixed"></div> <!-- treat as false for radio roles --> | ||
<div id="element2" role="menuitemradio" aria-checked="mixed"></div> <!-- treat as false for menuitemradio roles --> | ||
<div id="element3" role="checkbox" aria-checked="mixed"></div> | ||
<div id="element4" role="menuitemcheckbox" aria-checked="mixed"></div> | ||
<div id="element5" role="checkbox" indeterminate="true"></div> | ||
<div id="element6" role="checkbox" indeterminate="false"></div> | ||
|
||
</div> | ||
|
||
<p id="description"></p> | ||
<div id="console"></div> | ||
<div id="element3" role="menuitemcheckbox" aria-checked="mixed"></div> | ||
<div id="element4" role="checkbox"></div> | ||
<div id="element5" role="checkbox" aria-checked="mixed"></div> | ||
|
||
<script> | ||
|
||
description("Tests whether mixed values are reported properly."); | ||
|
||
if (window.accessibilityController) { | ||
for (var i = 1; i < 7; i++) { | ||
var element = accessibilityController.accessibleElementById("element" + i); | ||
debug("Role: " + element.role); | ||
debug("Mixed: " + element.isIndeterminate); | ||
debug("\n"); | ||
} | ||
|
||
document.getElementById("content").style.visibility = "hidden"; | ||
var output = "This test ensures mixed values are reported correctly.\n\n"; | ||
|
||
if (window.accessibilityController) { | ||
for (var i = 1; i < 6; i++) { | ||
const id = `element${i}`; | ||
output += `${escapeHTML(document.getElementById(id).outerHTML)}\n`; | ||
const axElement = accessibilityController.accessibleElementById(id); | ||
output += `Role: ${axElement.role}\n`; | ||
output += `Mixed: ${axElement.isIndeterminate}\n\n`; | ||
} | ||
|
||
debug(output); | ||
} | ||
</script> | ||
|
||
<script src="../resources/js-test-post.js"></script> | ||
</body> | ||
</html> | ||
|
18 changes: 6 additions & 12 deletions
18
LayoutTests/accessibility/checkbox-mixed-value-expected.txt
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,34 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../resources/js-test-pre.js"></script> | ||
<script src="../resources/accessibility-helper.js"></script> | ||
<script src="../resources/js-test.js"></script> | ||
</head> | ||
<body id="body"> | ||
<body> | ||
|
||
<div id="content"> | ||
|
||
<input type="checkbox" id="element1" indeterminate="true"> | ||
<input type="checkbox" id="element2" indeterminate="false"> | ||
<input type="checkbox" id="element3"> | ||
|
||
</div> | ||
|
||
<p id="description"></p> | ||
<div id="console"></div> | ||
<input type="checkbox" id="checkbox"> | ||
|
||
<script> | ||
var output = "This test ensures mixed values are reported properly on native checkboxes.\n\n"; | ||
|
||
description("Tests whether mixed values are reported properly on native checkboxes."); | ||
if (window.accessibilityController) { | ||
window.jsTestIsAsync = true; | ||
output += expect("accessibilityController.accessibleElementById('checkbox').isIndeterminate", "false"); | ||
|
||
if (window.accessibilityController) { | ||
for (var i = 1; i <= 3; i++) { | ||
var element = accessibilityController.accessibleElementById("element" + i); | ||
debug(i + ": " + element.role); | ||
debug("Indeterminate status: " + element.isIndeterminate + "\n"); | ||
} | ||
output += evalAndReturn("document.getElementById('checkbox').indeterminate = true"); | ||
setTimeout(async function() { | ||
await waitFor(() => accessibilityController.accessibleElementById("checkbox").isIndeterminate); | ||
output += expect("accessibilityController.accessibleElementById('checkbox').isIndeterminate", "true"); | ||
|
||
document.getElementById("content").style.visibility = "hidden"; | ||
} | ||
output += evalAndReturn("document.getElementById('checkbox').indeterminate = false"); | ||
await waitFor(() => !accessibilityController.accessibleElementById("checkbox").isIndeterminate); | ||
output += expect("accessibilityController.accessibleElementById('checkbox').isIndeterminate", "false"); | ||
|
||
debug(output); | ||
finishJSTest(); | ||
}, 0); | ||
} | ||
</script> | ||
|
||
<script src="../resources/js-test-post.js"></script> | ||
</body> | ||
</html> | ||
|
This file contains 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
27 changes: 27 additions & 0 deletions
27
LayoutTests/platform/ios/accessibility/aria-checked-mixed-value-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
This test ensures mixed values are reported correctly. | ||
|
||
<div id="element1" role="radio" aria-checked="mixed"></div> | ||
Role: RadioButton | ||
Mixed: false | ||
|
||
<div id="element2" role="menuitemradio" aria-checked="mixed"></div> | ||
Role: MenuItemRadio | ||
Mixed: false | ||
|
||
<div id="element3" role="menuitemcheckbox" aria-checked="mixed"></div> | ||
Role: MenuItemCheckbox | ||
Mixed: true | ||
|
||
<div id="element4" role="checkbox"></div> | ||
Role: CheckBox | ||
Mixed: false | ||
|
||
<div id="element5" role="checkbox" aria-checked="mixed"></div> | ||
Role: CheckBox | ||
Mixed: true | ||
|
||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
33 changes: 0 additions & 33 deletions
33
LayoutTests/platform/mac/accessibility/aria-checked-mixed-value-expected.txt
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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