- Revision
- 295413
- Author
- tyle...@apple.com
- Date
- 2022-06-08 23:58:04 -0700 (Wed, 08 Jun 2022)
Log Message
AX: The role of AccessibilityRole::TextField and AccessibilityRole::TextArea objects must be updated after dynamic changes to aria-multiline
https://bugs.webkit.org/show_bug.cgi?id=241428
Reviewed by Chris Fleizach.
The role value of AccessibilityRole::TextField and AccessibilityRole::TextArea
objects is dependent on their aria-multiline value. With this patch, we now
recompute the role of these objects when aria-multiline changes.
* LayoutTests/accessibility/aria-multiline-expected.txt: Added.
* LayoutTests/accessibility/aria-multiline.html: Added.
* LayoutTests/accessibility/mac/aria-multiline-expected.txt: Removed.
* LayoutTests/accessibility/mac/aria-multiline.html: Removed.
* LayoutTests/platform/ios/TestExpectations:
Enable aria-multiline.html.
* LayoutTests/platform/ios/accessibility/aria-multiline-expected.txt: Added.
* LayoutTests/platform/win/TestExpectations:
Disable aria-multiline.html.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::handleAttributeChange):
Canonical link: https://commits.webkit.org/251419@main
Modified Paths
Added Paths
Removed Paths
Diff
Added: trunk/LayoutTests/accessibility/aria-multiline-expected.txt (0 => 295413)
--- trunk/LayoutTests/accessibility/aria-multiline-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/aria-multiline-expected.txt 2022-06-09 06:58:04 UTC (rev 295413)
@@ -0,0 +1,14 @@
+This tests that aria-multiline will change the role of a text control from a text field to a text area.
+
+#textfield role: AXRole: AXTextField
+#textarea role: AXRole: AXTextArea
+
+Setting #textfield aria-multiline to true and #textarea aria-multiline to false.
+#textfield role: AXRole: AXTextArea
+#textarea role: AXRole: AXTextField
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+a
+b
Added: trunk/LayoutTests/accessibility/aria-multiline.html (0 => 295413)
--- trunk/LayoutTests/accessibility/aria-multiline.html (rev 0)
+++ trunk/LayoutTests/accessibility/aria-multiline.html 2022-06-09 06:58:04 UTC (rev 295413)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div tabindex="0" id="textfield" role="textbox" aria-multiline="false">a</div>
+<div tabindex="0" id="textarea" role="textbox" aria-multiline="true">b</div>
+
+<script>
+ var testOutput = "This tests that aria-multiline will change the role of a text control from a text field to a text area.\n\n";
+
+ if (window.accessibilityController) {
+ window.jsTestIsAsync = true;
+
+ const textField = accessibilityController.accessibleElementById("textfield");
+ const textArea = accessibilityController.accessibleElementById("textarea");
+ testOutput += `#textfield role: ${textField.role}\n`;
+ testOutput += `#textarea role: ${textArea.role}\n`;
+
+ testOutput += "\nSetting #textfield aria-multiline to true and #textarea aria-multiline to false.\n";
+ document.getElementById("textfield").ariaMultiLine = true;
+ document.getElementById("textarea").ariaMultiLine = false;
+ setTimeout(async function() {
+ await waitFor(() => {
+ return textField.role.includes("TextArea") &&
+ textArea.role.includes("TextField");
+ })
+ testOutput += `#textfield role: ${textField.role}\n`;
+ testOutput += `#textarea role: ${textArea.role}\n`;
+
+ debug(testOutput);
+ finishJSTest();
+ }, 0);
+ }
+</script>
+</body>
+</html>
+
Deleted: trunk/LayoutTests/accessibility/mac/aria-multiline-expected.txt (295412 => 295413)
--- trunk/LayoutTests/accessibility/mac/aria-multiline-expected.txt 2022-06-09 06:45:52 UTC (rev 295412)
+++ trunk/LayoutTests/accessibility/mac/aria-multiline-expected.txt 2022-06-09 06:58:04 UTC (rev 295413)
@@ -1,13 +0,0 @@
-a
-b
-This tests that aria-multiline will change the role of a text control from a text field to a text area.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS accessibilityController.accessibleElementById('textfield').role is 'AXRole: AXTextField'
-PASS accessibilityController.accessibleElementById('textarea').role is 'AXRole: AXTextArea'
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/accessibility/mac/aria-multiline.html (295412 => 295413)
--- trunk/LayoutTests/accessibility/mac/aria-multiline.html 2022-06-09 06:45:52 UTC (rev 295412)
+++ trunk/LayoutTests/accessibility/mac/aria-multiline.html 2022-06-09 06:58:04 UTC (rev 295413)
@@ -1,25 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body id="body">
-
-<div tabindex="0" id="textfield" role="textbox" aria-multiline="false">a</div>
-<div tabindex="0" id="textarea" role="textbox" aria-multiline="true">b</div>
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
- description("This tests that aria-multiline will change the role of a text control from a text field to a text area.");
-
- if (window.accessibilityController) {
- shouldBe("accessibilityController.accessibleElementById('textfield').role", "'AXRole: AXTextField'");
- shouldBe("accessibilityController.accessibleElementById('textarea').role", "'AXRole: AXTextArea'");
- }
-</script>
-
-<script src=""
-</body>
-</html>
Modified: trunk/LayoutTests/platform/glib/TestExpectations (295412 => 295413)
--- trunk/LayoutTests/platform/glib/TestExpectations 2022-06-09 06:45:52 UTC (rev 295412)
+++ trunk/LayoutTests/platform/glib/TestExpectations 2022-06-09 06:58:04 UTC (rev 295413)
@@ -350,6 +350,9 @@
# Timing out since it was added in https://bugs.webkit.org/show_bug.cgi?id=239434.
accessibility/text-updates-after-dynamic-change.html [ Skip ]
+# Failing since added in https://bugs.webkit.org/show_bug.cgi?id=241428.
+accessibility/aria-multiline.html [ Skip ]
+
# Missing AccessibilityUIElement::uiElementForSearchPredicate implementation.
accessibility/aria-modal-with-text-crash.html [ Skip ]
accessibility/display-contents-search-traversal.html [ Skip ]
Modified: trunk/LayoutTests/platform/ios/TestExpectations (295412 => 295413)
--- trunk/LayoutTests/platform/ios/TestExpectations 2022-06-09 06:45:52 UTC (rev 295412)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2022-06-09 06:58:04 UTC (rev 295413)
@@ -2118,6 +2118,7 @@
accessibility/aria-busy-updates-after-dynamic-change.html [ Pass ]
accessibility/aria-describedby-on-input.html [ Pass ]
accessibility/aria-hidden-display-contents-element.html [ Pass ]
+accessibility/aria-multiline.html [ Pass ]
accessibility/aria-readonly-updates-after-dynamic-change.html [ Pass ]
accessibility/aria-required-updates-after-dynamic-change.html [ Pass ]
accessibility/aria-slider-value.html [ Pass ]
Added: trunk/LayoutTests/platform/ios/accessibility/aria-multiline-expected.txt (0 => 295413)
--- trunk/LayoutTests/platform/ios/accessibility/aria-multiline-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios/accessibility/aria-multiline-expected.txt 2022-06-09 06:58:04 UTC (rev 295413)
@@ -0,0 +1,14 @@
+This tests that aria-multiline will change the role of a text control from a text field to a text area.
+
+#textfield role: TextField
+#textarea role: TextArea
+
+Setting #textfield aria-multiline to true and #textarea aria-multiline to false.
+#textfield role: TextArea
+#textarea role: TextField
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+a
+b
Modified: trunk/LayoutTests/platform/win/TestExpectations (295412 => 295413)
--- trunk/LayoutTests/platform/win/TestExpectations 2022-06-09 06:45:52 UTC (rev 295412)
+++ trunk/LayoutTests/platform/win/TestExpectations 2022-06-09 06:58:04 UTC (rev 295413)
@@ -465,6 +465,9 @@
# Failing since added in https://bugs.webkit.org/show_bug.cgi?id=241022.
accessibility/node-only-inert-object.html [ Failure ]
+# Failing since added in https://bugs.webkit.org/show_bug.cgi?id=241428.
+accessibility/aria-multiline.html [ Skip ]
+
# Probably wrong role after adding children to list (AXGroup instead of AXList).
accessibility/list-with-dynamically-changing-content.html [ Skip ]
accessibility/ignored-aria-role-description.html [ Skip ]
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (295412 => 295413)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2022-06-09 06:45:52 UTC (rev 295412)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2022-06-09 06:58:04 UTC (rev 295413)
@@ -1958,6 +1958,13 @@
postNotification(element, AXMaximumValueChanged);
else if (attrName == aria_valueminAttr)
postNotification(element, AXMinimumValueChanged);
+ else if (attrName == aria_multilineAttr) {
+ if (auto* axObject = get(element)) {
+ // The role of textarea and textfield objects is dependent on whether they can span multiple lines, so recompute it here.
+ if (axObject->roleValue() == AccessibilityRole::TextArea || axObject->roleValue() == AccessibilityRole::TextField)
+ axObject->updateRole();
+ }
+ }
else if (attrName == aria_multiselectableAttr)
postNotification(element, AXMultiSelectableStateChanged);
else if (attrName == aria_posinsetAttr)