AX: ARIA tree & treeitem roles & aria-expanded state not spoken to VoiceOver iOS 10
authorn_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Nov 2016 04:38:28 +0000 (04:38 +0000)
committern_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Nov 2016 04:38:28 +0000 (04:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164936
<rdar://problem/29334274>

Reviewed by Chris Fleizach.

Source/WebCore:

Added a new container type on iOS for trees. Also, since the treeitem role is ignored
on iOS, we should expose the expanded status of a treeitem to its accessible children.

Test: accessibility/ios-simulator/treeitem-expanded.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityTreeAncestor]):
(-[WebAccessibilityObjectWrapper treeItemParentForObject:]):
(-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):
(-[WebAccessibilityObjectWrapper accessibilityIsExpanded]):

LayoutTests:

* accessibility/ios-simulator/treeitem-expanded-expected.txt: Added.
* accessibility/ios-simulator/treeitem-expanded.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209118 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/ios-simulator/treeitem-expanded-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/ios-simulator/treeitem-expanded.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

index ee4126d..98dd29b 100644 (file)
@@ -1,3 +1,14 @@
+2016-11-29  Nan Wang  <n_wang@apple.com>
+
+        AX: ARIA tree & treeitem roles & aria-expanded state not spoken to VoiceOver iOS 10
+        https://bugs.webkit.org/show_bug.cgi?id=164936
+        <rdar://problem/29334274>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/treeitem-expanded-expected.txt: Added.
+        * accessibility/ios-simulator/treeitem-expanded.html: Added.
+
 2016-11-29  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r209096, r209104, and r209114.
diff --git a/LayoutTests/accessibility/ios-simulator/treeitem-expanded-expected.txt b/LayoutTests/accessibility/ios-simulator/treeitem-expanded-expected.txt
new file mode 100644 (file)
index 0000000..9411fed
--- /dev/null
@@ -0,0 +1,14 @@
+Projects
+Reports
+report-1.docx
+This tests that the expanded status of a treeitem is exposed to its unignored children.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS treeitem1.isExpanded is false
+PASS treeitem2.isExpanded is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/ios-simulator/treeitem-expanded.html b/LayoutTests/accessibility/ios-simulator/treeitem-expanded.html
new file mode 100644 (file)
index 0000000..cfa3b1a
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<ul role="tree" id="tree1">
+<li role="treeitem" aria-expanded="false" aria-label="Projects" tabindex="0">
+  <div id="projects">Projects</div>
+  <ul role="group">
+    <li role="treeitem" style="display: none;">project-1.docx</li>
+  </ul>
+</li>
+<li role="treeitem" aria-expanded="true" aria-label="Reports" tabindex="0">
+  <div id="reports">Reports</div>
+  <ul role="group">
+    <li role="treeitem" id="treeitem1" style="display: block;">report-1.docx</li>
+  </ul>
+</ul>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that the expanded status of a treeitem is exposed to its unignored children.");
+
+    if (window.accessibilityController) {
+
+        var treeitem1 = accessibilityController.accessibleElementById("projects");
+        var treeitem2 = accessibilityController.accessibleElementById("reports");
+        shouldBeFalse("treeitem1.isExpanded");
+        shouldBeTrue("treeitem2.isExpanded");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
+
index 8703ae5..a01e118 100644 (file)
@@ -1,3 +1,22 @@
+2016-11-29  Nan Wang  <n_wang@apple.com>
+
+        AX: ARIA tree & treeitem roles & aria-expanded state not spoken to VoiceOver iOS 10
+        https://bugs.webkit.org/show_bug.cgi?id=164936
+        <rdar://problem/29334274>
+
+        Reviewed by Chris Fleizach.
+
+        Added a new container type on iOS for trees. Also, since the treeitem role is ignored
+        on iOS, we should expose the expanded status of a treeitem to its accessible children.
+
+        Test: accessibility/ios-simulator/treeitem-expanded.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper _accessibilityTreeAncestor]):
+        (-[WebAccessibilityObjectWrapper treeItemParentForObject:]):
+        (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):
+        (-[WebAccessibilityObjectWrapper accessibilityIsExpanded]):
+
 2016-11-29  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r209096, r209104, and r209114.
index ce8caf5..63c7499 100644 (file)
@@ -531,6 +531,18 @@ static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityO
     }    
 }
 
+- (AccessibilityObjectWrapper*)_accessibilityTreeAncestor
+{
+    auto matchFunc = [] (const AccessibilityObject& object) {
+        AccessibilityRole role = object.roleValue();
+        return role == TreeRole;
+    };
+    
+    if (const AccessibilityObject* parent = AccessibilityObject::matchedParent(*m_object, false, matchFunc))
+        return parent->wrapper();
+    return nil;
+}
+
 - (AccessibilityObjectWrapper*)_accessibilityListAncestor
 {
     auto matchFunc = [] (const AccessibilityObject& object) {
@@ -1848,6 +1860,16 @@ static RenderObject* rendererForView(WAKView* view)
     return nil;
 }
 
+- (AccessibilityObject*)treeItemParentForObject:(AccessibilityObject*)object
+{
+    // Use this to check if an object is inside a treeitem object.
+    if (const AccessibilityObject* parent = AccessibilityObject::matchedParent(*object, true, [] (const AccessibilityObject& object) {
+        return object.roleValue() == TreeItemRole;
+    }))
+        return const_cast<AccessibilityObject*>(parent);
+    return nil;
+}
+
 - (void)accessibilityElementDidBecomeFocused
 {
     if (![self _prepareAccessibilityCall])
@@ -2708,6 +2730,9 @@ static void AXAttributedStringAppendText(NSMutableAttributedString* attrString,
     if (AccessibilityObject* detailParent = [self detailParentForSummaryObject:m_object])
         return detailParent->supportsExpanded();
     
+    if (AccessibilityObject* treeItemParent = [self treeItemParentForObject:m_object])
+        return treeItemParent->supportsExpanded();
+    
     return m_object->supportsExpanded();
 }
 
@@ -2721,6 +2746,9 @@ static void AXAttributedStringAppendText(NSMutableAttributedString* attrString,
     if (AccessibilityObject* detailParent = [self detailParentForSummaryObject:m_object])
         return detailParent->isExpanded();
     
+    if (AccessibilityObject* treeItemParent = [self treeItemParentForObject:m_object])
+        return treeItemParent->isExpanded();
+    
     return m_object->isExpanded();
 }