Title: [231720] trunk
Revision
231720
Author
n_w...@apple.com
Date
2018-05-11 14:58:19 -0700 (Fri, 11 May 2018)

Log Message

AX: In role=dialog elements with aria-modal=true VoiceOver iOS/macOS can't manually focus or read dialog paragraph description text inside the modal.
https://bugs.webkit.org/show_bug.cgi?id=185219
<rdar://problem/39920009>

Reviewed by Chris Fleizach.

Source/WebCore:

The text node descendants of a modal dialog are ignored. Fixed it by using AccessibilityObject's
node() to determine if it's the descendant of the modal dialog node.

Test: accessibility/aria-modal-text-descendants.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isModalDescendant const):

LayoutTests:

* accessibility/aria-modal-text-descendants-expected.txt: Added.
* accessibility/aria-modal-text-descendants.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231719 => 231720)


--- trunk/LayoutTests/ChangeLog	2018-05-11 21:16:05 UTC (rev 231719)
+++ trunk/LayoutTests/ChangeLog	2018-05-11 21:58:19 UTC (rev 231720)
@@ -1,3 +1,14 @@
+2018-05-11  Nan Wang  <n_w...@apple.com>
+
+        AX: In role=dialog elements with aria-modal=true VoiceOver iOS/macOS can't manually focus or read dialog paragraph description text inside the modal.
+        https://bugs.webkit.org/show_bug.cgi?id=185219
+        <rdar://problem/39920009>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-modal-text-descendants-expected.txt: Added.
+        * accessibility/aria-modal-text-descendants.html: Added.
+
 2018-05-11  Ryosuke Niwa  <rn...@webkit.org>
 
         Tapping after CSS-based table casues an infinite loop in wordRangeFromPosition

Added: trunk/LayoutTests/accessibility/aria-modal-text-descendants-expected.txt (0 => 231720)


--- trunk/LayoutTests/accessibility/aria-modal-text-descendants-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-modal-text-descendants-expected.txt	2018-05-11 21:58:19 UTC (rev 231720)
@@ -0,0 +1,17 @@
+This tests text descendants of modal dialog are accessible.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS backgroundAccessible() is false
+PASS text.isIgnored is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Other page content with a dummy focusable element
+
+Display a dialog
+
+Just an example.
+
+text

Added: trunk/LayoutTests/accessibility/aria-modal-text-descendants.html (0 => 231720)


--- trunk/LayoutTests/accessibility/aria-modal-text-descendants.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-modal-text-descendants.html	2018-05-11 21:58:19 UTC (rev 231720)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+
+<body id="body">
+
+<div id="bg">
+<p id="bgContent">Other page content with <a href="" dummy focusable element</a></p>
+<p><a href="" role="button" id="displayBtn">Display a dialog</a></p>
+</div>
+
+<div role="dialog" aria-modal="true" aria-labelledby="myDialog" id="box" class="box-hidden" tabindex="-1">
+    <h3 id="myDialog">Just an example.</h3>
+    <p id="text">text</p>
+</div>
+
+
+<script>
+
+    description("This tests text descendants of modal dialog are accessible.");
+
+    if (window.accessibilityController) {
+        // Background should be unaccessible after loading, since the 
+        // dialog is displayed and aria-modal=true.
+        shouldBeFalse("backgroundAccessible()");
+        
+        var text = accessibilityController.accessibleElementById("text").childAtIndex(0);
+        shouldBeFalse("text.isIgnored");
+    }
+    
+    function backgroundAccessible() {
+        var displayBtn = accessibilityController.accessibleElementById("displayBtn");
+        var bgContent = accessibilityController.accessibleElementById("bgContent");
+        
+        if (!displayBtn || !bgContent)
+            return false;
+        
+        return !displayBtn.isIgnored && !bgContent.isIgnored;
+    }
+
+
+</script>
+
+
+<script src=""
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (231719 => 231720)


--- trunk/Source/WebCore/ChangeLog	2018-05-11 21:16:05 UTC (rev 231719)
+++ trunk/Source/WebCore/ChangeLog	2018-05-11 21:58:19 UTC (rev 231720)
@@ -1,3 +1,19 @@
+2018-05-11  Nan Wang  <n_w...@apple.com>
+
+        AX: In role=dialog elements with aria-modal=true VoiceOver iOS/macOS can't manually focus or read dialog paragraph description text inside the modal.
+        https://bugs.webkit.org/show_bug.cgi?id=185219
+        <rdar://problem/39920009>
+
+        Reviewed by Chris Fleizach.
+
+        The text node descendants of a modal dialog are ignored. Fixed it by using AccessibilityObject's 
+        node() to determine if it's the descendant of the modal dialog node.
+
+        Test: accessibility/aria-modal-text-descendants.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isModalDescendant const):
+
 2018-05-11  Ryosuke Niwa  <rn...@webkit.org>
 
         Tapping after CSS-based table casues an infinite loop in wordRangeFromPosition

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (231719 => 231720)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2018-05-11 21:16:05 UTC (rev 231719)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2018-05-11 21:58:19 UTC (rev 231720)
@@ -2088,19 +2088,16 @@
 
 bool AccessibilityObject::isModalDescendant(Node* modalNode) const
 {
-    if (!modalNode || !this->element())
+    Node* node = this->node();
+    if (!modalNode || !node)
         return false;
     
-    if (this->element() == modalNode)
+    if (node == modalNode)
         return true;
     
     // ARIA 1.1 aria-modal, indicates whether an element is modal when displayed.
     // For the decendants of the modal object, they should also be considered as aria-modal=true.
-    for (auto& ancestor : elementAncestors(this->element())) {
-        if (&ancestor == modalNode)
-            return true;
-    }
-    return false;
+    return node->isDescendantOf(*modalNode);
 }
 
 bool AccessibilityObject::isModalNode() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to