Title: [294667] branches/safari-7613.3.1.0-branch
Revision
294667
Author
[email protected]
Date
2022-05-23 12:44:07 -0700 (Mon, 23 May 2022)

Log Message

Cherry-pick r289713. rdar://problem/93601919

    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.

    Canonical link: https://commits.webkit.org/247198@main
    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289713 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-7613.3.1.0-branch/LayoutTests/ChangeLog (294666 => 294667)


--- branches/safari-7613.3.1.0-branch/LayoutTests/ChangeLog	2022-05-23 19:41:32 UTC (rev 294666)
+++ branches/safari-7613.3.1.0-branch/LayoutTests/ChangeLog	2022-05-23 19:44:07 UTC (rev 294667)
@@ -1,3 +1,50 @@
+2022-05-23  Alan Coon  <[email protected]>
+
+        Cherry-pick r289713. rdar://problem/93601919
+
+    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.
+    
+    Canonical link: https://commits.webkit.org/247198@main
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289713 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-05-03  Sihui Liu  <[email protected]>
 
         StorageMap::removeItem may fail to remove item from map

Added: branches/safari-7613.3.1.0-branch/LayoutTests/accessibility/dialog-properties-expected.txt (0 => 294667)


--- branches/safari-7613.3.1.0-branch/LayoutTests/accessibility/dialog-properties-expected.txt	                        (rev 0)
+++ branches/safari-7613.3.1.0-branch/LayoutTests/accessibility/dialog-properties-expected.txt	2022-05-23 19:44:07 UTC (rev 294667)
@@ -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: branches/safari-7613.3.1.0-branch/LayoutTests/accessibility/dialog-properties.html (0 => 294667)


--- branches/safari-7613.3.1.0-branch/LayoutTests/accessibility/dialog-properties.html	                        (rev 0)
+++ branches/safari-7613.3.1.0-branch/LayoutTests/accessibility/dialog-properties.html	2022-05-23 19:44:07 UTC (rev 294667)
@@ -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: branches/safari-7613.3.1.0-branch/LayoutTests/platform/gtk/TestExpectations (294666 => 294667)


--- branches/safari-7613.3.1.0-branch/LayoutTests/platform/gtk/TestExpectations	2022-05-23 19:41:32 UTC (rev 294666)
+++ branches/safari-7613.3.1.0-branch/LayoutTests/platform/gtk/TestExpectations	2022-05-23 19:44:07 UTC (rev 294667)
@@ -2130,3 +2130,5 @@
 #////////////////////////////////////////////////////////////////////////////////////////
 # UNSORTED Expectations. When in doubt, put it here.
 #////////////////////////////////////////////////////////////////////////////////////////
+
+accessibility/dialog-properties.html [ Skip ]

Modified: branches/safari-7613.3.1.0-branch/LayoutTests/platform/win/TestExpectations (294666 => 294667)


--- branches/safari-7613.3.1.0-branch/LayoutTests/platform/win/TestExpectations	2022-05-23 19:41:32 UTC (rev 294666)
+++ branches/safari-7613.3.1.0-branch/LayoutTests/platform/win/TestExpectations	2022-05-23 19:44:07 UTC (rev 294667)
@@ -4739,6 +4739,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: branches/safari-7613.3.1.0-branch/Source/WebCore/ChangeLog (294666 => 294667)


--- branches/safari-7613.3.1.0-branch/Source/WebCore/ChangeLog	2022-05-23 19:41:32 UTC (rev 294666)
+++ branches/safari-7613.3.1.0-branch/Source/WebCore/ChangeLog	2022-05-23 19:44:07 UTC (rev 294667)
@@ -1,3 +1,56 @@
+2022-05-23  Alan Coon  <[email protected]>
+
+        Cherry-pick r289713. rdar://problem/93601919
+
+    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.
+    
+    Canonical link: https://commits.webkit.org/247198@main
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289713 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-05-03  Sihui Liu  <[email protected]>
 
         StorageMap::removeItem may fail to remove item from map

Modified: branches/safari-7613.3.1.0-branch/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (294666 => 294667)


--- branches/safari-7613.3.1.0-branch/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2022-05-23 19:41:32 UTC (rev 294666)
+++ branches/safari-7613.3.1.0-branch/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2022-05-23 19:44:07 UTC (rev 294667)
@@ -282,9 +282,13 @@
         return AccessibilityRole::Paragraph;
     if (is<HTMLLabelElement>(*node()))
         return AccessibilityRole::Label;
+
+    if (node()->hasTagName(dialogTag))
+        return AccessibilityRole::ApplicationDialog;
+    
     if (is<Element>(*node()) && downcast<Element>(*node()).isFocusable())
         return AccessibilityRole::Group;
-    
+
     return AccessibilityRole::Unknown;
 }
 

Modified: branches/safari-7613.3.1.0-branch/Source/WebCore/accessibility/AccessibilityObject.cpp (294666 => 294667)


--- branches/safari-7613.3.1.0-branch/Source/WebCore/accessibility/AccessibilityObject.cpp	2022-05-23 19:41:32 UTC (rev 294666)
+++ branches/safari-7613.3.1.0-branch/Source/WebCore/accessibility/AccessibilityObject.cpp	2022-05-23 19:44:07 UTC (rev 294667)
@@ -3542,16 +3542,20 @@
 AccessibilityObjectInclusion AccessibilityObject::defaultObjectInclusion() const
 {
     bool useParentData = !m_isIgnoredFromParentData.isNull();
-    
+
     if (useParentData ? m_isIgnoredFromParentData.isAXHidden : isAXHidden())
         return AccessibilityObjectInclusion::IgnoreObject;
 
     if (renderer() && renderer()->style().effectiveInert())
         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