Title: [207647] trunk
Revision
207647
Author
n_w...@apple.com
Date
2016-10-20 18:15:21 -0700 (Thu, 20 Oct 2016)

Log Message

AX: VoiceOver is not detecting ARIA treeview if it contains role="presentation"
https://bugs.webkit.org/show_bug.cgi?id=163763

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/mac/aria-tree-with-presentation-role.html

Web authors sometimes use presentation role in the aria tree to hide elements. We should
consider this a valid case if they specify tree items and groups correctly.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::hierarchicalLevel):
* accessibility/AccessibilityTree.cpp:
(WebCore::AccessibilityTree::nodeHasTreeItemChild):
(WebCore::AccessibilityTree::isTreeValid):
* accessibility/AccessibilityTree.h:

LayoutTests:

* accessibility/mac/aria-tree-with-presentation-role-expected.txt: Added.
* accessibility/mac/aria-tree-with-presentation-role.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207646 => 207647)


--- trunk/LayoutTests/ChangeLog	2016-10-21 00:15:31 UTC (rev 207646)
+++ trunk/LayoutTests/ChangeLog	2016-10-21 01:15:21 UTC (rev 207647)
@@ -1,3 +1,13 @@
+2016-10-20  Nan Wang  <n_w...@apple.com>
+
+        AX: VoiceOver is not detecting ARIA treeview if it contains role="presentation"
+        https://bugs.webkit.org/show_bug.cgi?id=163763
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/aria-tree-with-presentation-role-expected.txt: Added.
+        * accessibility/mac/aria-tree-with-presentation-role.html: Added.
+
 2016-10-19  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9

Added: trunk/LayoutTests/accessibility/mac/aria-tree-with-presentation-role-expected.txt (0 => 207647)


--- trunk/LayoutTests/accessibility/mac/aria-tree-with-presentation-role-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/aria-tree-with-presentation-role-expected.txt	2016-10-21 01:15:21 UTC (rev 207647)
@@ -0,0 +1,22 @@
+Release Notes
+Using Search
+Power Search
+Common Info Area
+This tests that aria trees are correctly exposed when there is role='presentation' presented.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXOutline AXValue: 
+  AXRole: AXRow level: 0
+    AXRole: AXStaticText AXValue: Release Notes
+  AXRole: AXRow level: 0
+    AXRole: AXStaticText AXValue: Using Search
+  AXRole: AXRow level: 1
+    AXRole: AXStaticText AXValue: Power Search
+  AXRole: AXRow level: 0
+    AXRole: AXStaticText AXValue: Common Info Area
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/aria-tree-with-presentation-role.html (0 => 207647)


--- trunk/LayoutTests/accessibility/mac/aria-tree-with-presentation-role.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/aria-tree-with-presentation-role.html	2016-10-21 01:15:21 UTC (rev 207647)
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<ul id="tree" role="tree" aria-label="Help Topics">
+<li role="treeitem">Release Notes</li>
+<li role="presentation">  
+<span role="treeitem" aria-expanded="true">Using Search</span>
+<ul role="group" aria-label="Using Search" aria-expanded="true">
+<li role="treeitem">Power Search</li>
+</ul>
+</li>
+<li role="presentation">
+<span role="treeitem" aria-expanded="false">Common Info Area</span>
+</li>
+</ul>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that aria trees are correctly exposed when there is role='presentation' presented.");
+
+    if (window.accessibilityController) {
+    
+          // Test tree attributes.
+          var tree = accessibilityController.accessibleElementById("tree");
+          dumpAccessibilityChildren(tree, 0);
+    }
+    
+    function dumpAccessibilityChildren(element, level) {
+        if (element.stringValue.indexOf('End of test') >= 0)
+            return false;
+
+        var indent = "";
+        for (var k = 0; k < level; k++) { indent += "  "; }
+        if (element.role == "AXRole: AXRow")
+            debug(indent + element.role + " " + "level: " + element.hierarchicalLevel);
+        else
+            debug(indent + element.role + " " + element.stringValue);
+        var childrenCount = element.childrenCount;
+        for (var k = 0; k < childrenCount; k++) {
+            if (!dumpAccessibilityChildren(element.childAtIndex(k), level+1))
+                return false;
+        }
+        return true;
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (207646 => 207647)


--- trunk/Source/WebCore/ChangeLog	2016-10-21 00:15:31 UTC (rev 207646)
+++ trunk/Source/WebCore/ChangeLog	2016-10-21 01:15:21 UTC (rev 207647)
@@ -1,3 +1,22 @@
+2016-10-20  Nan Wang  <n_w...@apple.com>
+
+        AX: VoiceOver is not detecting ARIA treeview if it contains role="presentation"
+        https://bugs.webkit.org/show_bug.cgi?id=163763
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/mac/aria-tree-with-presentation-role.html
+
+        Web authors sometimes use presentation role in the aria tree to hide elements. We should
+        consider this a valid case if they specify tree items and groups correctly.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::hierarchicalLevel):
+        * accessibility/AccessibilityTree.cpp:
+        (WebCore::AccessibilityTree::nodeHasTreeItemChild):
+        (WebCore::AccessibilityTree::isTreeValid):
+        * accessibility/AccessibilityTree.h:
+
 2016-10-20  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Many WebGL functions which don't throw are marked as possibly throwing

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (207646 => 207647)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2016-10-21 00:15:31 UTC (rev 207646)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2016-10-21 01:15:21 UTC (rev 207647)
@@ -1615,7 +1615,7 @@
     // We measure tree hierarchy by the number of groups that the item is within.
     unsigned level = 1;
     for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
-        AccessibilityRole parentRole = parent->roleValue();
+        AccessibilityRole parentRole = parent->ariaRoleAttribute();
         if (parentRole == GroupRole)
             level++;
         else if (parentRole == TreeRole)

Modified: trunk/Source/WebCore/accessibility/AccessibilityTree.cpp (207646 => 207647)


--- trunk/Source/WebCore/accessibility/AccessibilityTree.cpp	2016-10-21 00:15:31 UTC (rev 207646)
+++ trunk/Source/WebCore/accessibility/AccessibilityTree.cpp	2016-10-21 01:15:21 UTC (rev 207647)
@@ -67,6 +67,15 @@
     return isTreeValid() ? TreeRole : GroupRole;
 }
 
+bool AccessibilityTree::nodeHasTreeItemChild(Node& node) const
+{
+    for (auto* child = node.firstChild(); child; child = child->nextSibling()) {
+        if (nodeHasRole(child, "treeitem"))
+            return true;
+    }
+    return false;
+}
+
 bool AccessibilityTree::isTreeValid() const
 {
     // A valid tree can only have treeitem or group of treeitems as a child
@@ -87,6 +96,11 @@
             continue;
         if (nodeHasRole(child, "treeitem"))
             continue;
+        if (nodeHasRole(child, "presentation")) {
+            if (!nodeHasTreeItemChild(*child))
+                return false;
+            continue;
+        }
         if (!nodeHasRole(child, "group"))
             return false;
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityTree.h (207646 => 207647)


--- trunk/Source/WebCore/accessibility/AccessibilityTree.h	2016-10-21 00:15:31 UTC (rev 207646)
+++ trunk/Source/WebCore/accessibility/AccessibilityTree.h	2016-10-21 01:15:21 UTC (rev 207647)
@@ -44,6 +44,7 @@
     bool computeAccessibilityIsIgnored() const override;
     AccessibilityRole determineAccessibilityRole() override;
     bool isTreeValid() const;
+    bool nodeHasTreeItemChild(Node&) const;
 };
     
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to