Title: [289713] trunk
Revision
289713
Author
[email protected]
Date
2022-02-13 08:00:33 -0800 (Sun, 13 Feb 2022)

Log Message

Expose the correct role, subrole and role description properties for the <dialog> element.
https://bugs.webkit.org/show_bug.cgi?id=236359

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/dialog-properties.html

Elements with role="dialog" are exposed to accessibility clients with
role AXGroup, subrole AXApplicationDialog and role description
"web dialog". This patch implements this behavior for the <dialog>
element.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::determineAccessibilityRoleFromNode const):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::defaultObjectInclusion const):

LayoutTests:

Tests that these AX properties have the expected values both when the
dialog is shown modal or modeless.

* accessibility/dialog-properties-expected.txt: Added.
* accessibility/dialog-properties.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (289712 => 289713)


--- trunk/LayoutTests/ChangeLog	2022-02-13 14:56:52 UTC (rev 289712)
+++ trunk/LayoutTests/ChangeLog	2022-02-13 16:00:33 UTC (rev 289713)
@@ -1,3 +1,16 @@
+2022-02-13  Andres Gonzalez  <[email protected]>
+
+        Expose the correct role, subrole and role description properties for the <dialog> element.
+        https://bugs.webkit.org/show_bug.cgi?id=236359
+
+        Reviewed by Chris Fleizach.
+
+        Tests that these AX properties have the expected values both when the
+        dialog is shown modal or modeless.
+
+        * accessibility/dialog-properties-expected.txt: Added.
+        * accessibility/dialog-properties.html: Added.
+
 2022-02-12  Tim Nguyen  <[email protected]>
 
         Skip imported/w3c/web-platform-tests/url/toascii.window.html on Catalina/Big Sur

Added: trunk/LayoutTests/accessibility/dialog-properties-expected.txt (0 => 289713)


--- trunk/LayoutTests/accessibility/dialog-properties-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/dialog-properties-expected.txt	2022-02-13 16:00:33 UTC (rev 289713)
@@ -0,0 +1,15 @@
+This test verifies several AX properties of the dialog element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Modal dialog:
+AXRole: AXGroup AXSubrole: AXApplicationDialog AXRoleDescription: web dialog
+Modeless dialog:
+AXRole: AXGroup AXSubrole: AXApplicationDialog AXRoleDescription: web dialog
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Just a dialog.
+
+OK  Cancel

Added: trunk/LayoutTests/accessibility/dialog-properties.html (0 => 289713)


--- trunk/LayoutTests/accessibility/dialog-properties.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/dialog-properties.html	2022-02-13 16:00:33 UTC (rev 289713)
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body id="body">
+
+<dialog id="dialog">
+    <h3>Just a dialog.</h3>
+    <button id="ok" _onclick_="document.getElementById('dialog').close();" class="close-button">OK</button>
+    <button _onclick_="document.getElementById('dialog').close();" class="close-button">Cancel</button>
+</dialog>
+
+<script>
+    description("This test verifies several AX properties of the dialog element.");
+
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        setTimeout(async () => {
+            // Show the dialog as modal.
+            debug("Modal dialog:");
+            document.getElementById("dialog").showModal();
+            let dialog = null;
+            await waitFor(() => {
+                dialog = accessibilityController.accessibleElementById("dialog");
+                return dialog;
+            });
+            let properties = `${dialog.role} ${dialog.subrole} ${dialog.roleDescription}`;
+            debug(properties);
+
+            // Dismiss the modal and show the dialog as modeless.
+            document.getElementById("dialog").close();
+            debug("Modeless dialog:");
+            document.getElementById("dialog").show();
+            dialog = null;
+            await waitFor(() => {
+                dialog = accessibilityController.accessibleElementById("dialog");
+                return dialog;
+            });
+            properties = `${dialog.role} ${dialog.subrole} ${dialog.roleDescription}`;
+            debug(properties);
+
+            finishJSTest();
+        }, 0);
+    }
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (289712 => 289713)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2022-02-13 14:56:52 UTC (rev 289712)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2022-02-13 16:00:33 UTC (rev 289713)
@@ -1849,6 +1849,8 @@
 # UNSORTED Expectations. When in doubt, put it here.
 #////////////////////////////////////////////////////////////////////////////////////////
 
+accessibility/dialog-properties.html [ Skip ]
+
 # These tests require platform support.
 media/media-allowed-codecs.html
 media/media-allowed-containers.html
\ No newline at end of file

Modified: trunk/LayoutTests/platform/win/TestExpectations (289712 => 289713)


--- trunk/LayoutTests/platform/win/TestExpectations	2022-02-13 14:56:52 UTC (rev 289712)
+++ trunk/LayoutTests/platform/win/TestExpectations	2022-02-13 16:00:33 UTC (rev 289713)
@@ -4920,6 +4920,7 @@
 
 accessibility/selected-state-changed-notifications.html [ Skip ]
 accessibility/element-line-rects-and-text.html [ Skip ]
+accessibility/dialog-properties.html [ Skip ]
 
 webkit.org/b/229247 http/tests/fetch/keepalive-fetch-2.html [ Pass Failure ]
 

Modified: trunk/Source/WebCore/ChangeLog (289712 => 289713)


--- trunk/Source/WebCore/ChangeLog	2022-02-13 14:56:52 UTC (rev 289712)
+++ trunk/Source/WebCore/ChangeLog	2022-02-13 16:00:33 UTC (rev 289713)
@@ -1,3 +1,22 @@
+2022-02-13  Andres Gonzalez  <[email protected]>
+
+        Expose the correct role, subrole and role description properties for the <dialog> element.
+        https://bugs.webkit.org/show_bug.cgi?id=236359
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/dialog-properties.html
+
+        Elements with role="dialog" are exposed to accessibility clients with
+        role AXGroup, subrole AXApplicationDialog and role description
+        "web dialog". This patch implements this behavior for the <dialog>
+        element.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::determineAccessibilityRoleFromNode const):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::defaultObjectInclusion const):
+
 2022-02-13  Alan Bujtas  <[email protected]>
 
         [LFC][Integration] Introduce Box::ElementType::IntegrationInlineBlock

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (289712 => 289713)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2022-02-13 14:56:52 UTC (rev 289712)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2022-02-13 16:00:33 UTC (rev 289713)
@@ -358,6 +358,8 @@
         return AccessibilityRole::Blockquote;
     if (node()->hasTagName(captionTag))
         return AccessibilityRole::Caption;
+    if (node()->hasTagName(dialogTag))
+        return AccessibilityRole::ApplicationDialog;
     if (node()->hasTagName(markTag))
         return AccessibilityRole::Mark;
     if (node()->hasTagName(preTag))
@@ -414,7 +416,7 @@
         return AccessibilityRole::Group;
     if (is<Element>(*node()) && downcast<Element>(*node()).isFocusable())
         return AccessibilityRole::Group;
-    
+
     return AccessibilityRole::Unknown;
 }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (289712 => 289713)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2022-02-13 14:56:52 UTC (rev 289712)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2022-02-13 16:00:33 UTC (rev 289713)
@@ -3612,16 +3612,20 @@
 AccessibilityObjectInclusion AccessibilityObject::defaultObjectInclusion() const
 {
     bool useParentData = !m_isIgnoredFromParentData.isNull();
-    
+
     if (useParentData ? m_isIgnoredFromParentData.isAXHidden : isAXHidden())
         return AccessibilityObjectInclusion::IgnoreObject;
 
     if ((renderer() && renderer()->style().effectiveInert()) || ignoredFromModalPresence())
         return AccessibilityObjectInclusion::IgnoreObject;
-    
+
     if (useParentData ? m_isIgnoredFromParentData.isPresentationalChildOfAriaRole : isPresentationalChildOfAriaRole())
         return AccessibilityObjectInclusion::IgnoreObject;
-    
+
+    // Include <dialog> elements and elements with role="dialog".
+    if (roleValue() == AccessibilityRole::ApplicationDialog)
+        return AccessibilityObjectInclusion::IncludeObject;
+
     return accessibilityPlatformIncludesObject();
 }
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to