Title: [288425] trunk
Revision
288425
Author
tyle...@apple.com
Date
2022-01-23 15:10:34 -0800 (Sun, 23 Jan 2022)

Log Message

AX Isolated Tree Mode: Re-compute AXPropertyName::IsEnabled when a node experiences AXDisabledStateChanged
https://bugs.webkit.org/show_bug.cgi?id=235295

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/dynamic-attribute-changes-should-update-isenabled.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::updateIsolatedTree):
Re-compute AXPropertyName::IsEnabled when receiving an AXDisabledStateChanged notification.
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateNodeProperty):
Handle requests for AXPropertyName::IsEnabled updates.

LayoutTests:

This patch adds a test verifying that AXPropertyName::IsEnabled is re-computed when an
object's disabled state changes.

* accessibility/dynamic-attribute-changes-should-update-isenabled-expected.txt: Added.
* accessibility/dynamic-attribute-changes-should-update-isenabled.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288424 => 288425)


--- trunk/LayoutTests/ChangeLog	2022-01-23 21:50:29 UTC (rev 288424)
+++ trunk/LayoutTests/ChangeLog	2022-01-23 23:10:34 UTC (rev 288425)
@@ -1,3 +1,16 @@
+2022-01-23  Tyler Wilcock  <tyle...@apple.com>
+
+        AX Isolated Tree Mode: Re-compute AXPropertyName::IsEnabled when a node experiences AXDisabledStateChanged
+        https://bugs.webkit.org/show_bug.cgi?id=235295
+
+        Reviewed by Chris Fleizach.
+
+        This patch adds a test verifying that AXPropertyName::IsEnabled is re-computed when an
+        object's disabled state changes.
+
+        * accessibility/dynamic-attribute-changes-should-update-isenabled-expected.txt: Added.
+        * accessibility/dynamic-attribute-changes-should-update-isenabled.html: Added.
+
 2022-01-23  Antoine Quint  <grao...@webkit.org>
 
         [Model] Add load and error events to distinguish resource load from model readiness

Added: trunk/LayoutTests/accessibility/dynamic-attribute-changes-should-update-isenabled-expected.txt (0 => 288425)


--- trunk/LayoutTests/accessibility/dynamic-attribute-changes-should-update-isenabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/dynamic-attribute-changes-should-update-isenabled-expected.txt	2022-01-23 23:10:34 UTC (rev 288425)
@@ -0,0 +1,28 @@
+This test ensures that dynamically changing elements disabled and aria-disabled attributes properly updates their isEnabled property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Verifying initial element enabled state.
+PASS axButton.isEnabled is true
+PASS axOption.isEnabled is true
+domButton.ariaDisabled = true
+PASS axButton.isEnabled === false
+domButton.ariaDisabled = false
+PASS axButton.isEnabled === true
+domButton.disabled = true
+PASS axButton.isEnabled === false
+domButton.disabled = false
+PASS axButton.isEnabled === true
+domOption.ariaDisabled = true
+PASS axOption.isEnabled === false
+domOption.ariaDisabled = false
+PASS axOption.isEnabled === true
+domOption.disabled = true
+PASS axOption.isEnabled === false
+domOption.disabled = false
+PASS axOption.isEnabled === true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Click me

Added: trunk/LayoutTests/accessibility/dynamic-attribute-changes-should-update-isenabled.html (0 => 288425)


--- trunk/LayoutTests/accessibility/dynamic-attribute-changes-should-update-isenabled.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/dynamic-attribute-changes-should-update-isenabled.html	2022-01-23 23:10:34 UTC (rev 288425)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<button id="button">Click me</button>
+
+<select multiple id="select">
+    <option id="option1">Option 1</option>
+    <option>Option 2</option>
+    <option>Option 3</option>
+</select>
+
+<script>
+    description("This test ensures that dynamically changing elements disabled and aria-disabled attributes properly updates their isEnabled property.");
+
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        var axOption = accessibilityController.accessibleElementById("option1");
+        var domOption = document.getElementById("option1");
+        var axButton = accessibilityController.accessibleElementById("button");
+        var domButton = document.getElementById("button");
+        debug("Verifying initial element enabled state.");
+        shouldBe("axButton.isEnabled", "true");
+        shouldBe("axOption.isEnabled", "true");
+
+        setTimeout(async function() {
+            evalAndLog("domButton.ariaDisabled = true");
+            await expectAsyncExpression("axButton.isEnabled", "false");
+
+            evalAndLog("domButton.ariaDisabled = false");
+            await expectAsyncExpression("axButton.isEnabled", "true");
+
+            evalAndLog("domButton.disabled = true");
+            await expectAsyncExpression("axButton.isEnabled", "false");
+
+            evalAndLog("domButton.disabled = false");
+            await expectAsyncExpression("axButton.isEnabled", "true");
+
+            evalAndLog("domOption.ariaDisabled = true");
+            await expectAsyncExpression("axOption.isEnabled", "false");
+
+            evalAndLog("domOption.ariaDisabled = false");
+            await expectAsyncExpression("axOption.isEnabled", "true");
+
+            evalAndLog("domOption.disabled = true");
+            await expectAsyncExpression("axOption.isEnabled", "false");
+
+            evalAndLog("domOption.disabled = false");
+            await expectAsyncExpression("axOption.isEnabled", "true");
+
+            finishJSTest();
+        }, 0);
+    }
+</script>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (288424 => 288425)


--- trunk/Source/WebCore/ChangeLog	2022-01-23 21:50:29 UTC (rev 288424)
+++ trunk/Source/WebCore/ChangeLog	2022-01-23 23:10:34 UTC (rev 288425)
@@ -1,3 +1,19 @@
+2022-01-23  Tyler Wilcock  <tyle...@apple.com>
+
+        AX Isolated Tree Mode: Re-compute AXPropertyName::IsEnabled when a node experiences AXDisabledStateChanged
+        https://bugs.webkit.org/show_bug.cgi?id=235295
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/dynamic-attribute-changes-should-update-isenabled.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::updateIsolatedTree):
+        Re-compute AXPropertyName::IsEnabled when receiving an AXDisabledStateChanged notification.
+        * accessibility/isolatedtree/AXIsolatedTree.cpp:
+        (WebCore::AXIsolatedTree::updateNodeProperty):
+        Handle requests for AXPropertyName::IsEnabled updates.
+
 2022-01-23  Antoine Quint  <grao...@webkit.org>
 
         [Model] Add load and error events to distinguish resource load from model readiness

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (288424 => 288425)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2022-01-23 21:50:29 UTC (rev 288424)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2022-01-23 23:10:34 UTC (rev 288425)
@@ -3327,6 +3327,7 @@
             break;
         case AXDisabledStateChanged:
             tree->updateNodeProperty(*notification.first, AXPropertyName::CanSetFocusAttribute);
+            tree->updateNodeProperty(*notification.first, AXPropertyName::IsEnabled);
             break;
         case AXSortDirectionChanged:
             tree->updateNodeProperty(*notification.first, AXPropertyName::SortDirection);

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (288424 => 288425)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2022-01-23 21:50:29 UTC (rev 288424)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp	2022-01-23 23:10:34 UTC (rev 288425)
@@ -291,6 +291,9 @@
     case AXPropertyName::IsChecked:
         propertyMap.set(AXPropertyName::IsChecked, axObject.isChecked());
         break;
+    case AXPropertyName::IsEnabled:
+        propertyMap.set(AXPropertyName::IsEnabled, axObject.isEnabled());
+        break;
     case AXPropertyName::SortDirection:
         propertyMap.set(AXPropertyName::SortDirection, static_cast<int>(axObject.sortDirection()));
         break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to