AX:ARIA Toggle buttons aren't properly conveyed on iOS using VoiceOver
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jun 2015 06:04:25 +0000 (06:04 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jun 2015 06:04:25 +0000 (06:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145949

Reviewed by Darin Adler.

Source/WebCore:

Expose pressed state information to the iOS platform AX API.

Test: Updated inspector-protocol/dom/getAccessibilityPropertiesForNode.html
      There was a FIXME for this issue in that test: https://bugs.webkit.org/show_bug.cgi?id=129830

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isPressed):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::classList):
(WebCore::AccessibilityObject::supportsARIAPressed):
(WebCore::AccessibilityObject::supportsARIAExpanded):
* accessibility/AccessibilityObject.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityARIALiveRegionIsAtomic]):
(-[WebAccessibilityObjectWrapper accessibilitySupportsARIAPressed]):
(-[WebAccessibilityObjectWrapper accessibilityIsPressed]):
(-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):

LayoutTests:

* inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt:
* inspector-protocol/dom/getAccessibilityPropertiesForNode.html:

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

LayoutTests/ChangeLog
LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt
LayoutTests/inspector-protocol/dom/getAccessibilityPropertiesForNode.html
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

index 3ece6f6..94d6ed9 100644 (file)
@@ -1,3 +1,13 @@
+2015-06-12  Chris Fleizach  <cfleizach@apple.com>
+
+        AX:ARIA Toggle buttons aren't properly conveyed on iOS using VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=145949
+
+        Reviewed by Darin Adler.
+
+        * inspector-protocol/dom/getAccessibilityPropertiesForNode-expected.txt:
+        * inspector-protocol/dom/getAccessibilityPropertiesForNode.html:
+
 2015-06-12  Darin Adler  <darin@apple.com>
 
         Fix minor ES6 compliance issue in RegExp.prototype.toString and optimize performance a little
index 6539b6d..f2760ed 100644 (file)
@@ -393,13 +393,13 @@ Total elements to be tested: 65.
     pressed: false
     required: false
 
-<div role="button" tabindex="0" aria-pressed="true">FIXME: Pressed is false. Expected true. http://webkit.org/b/129830</div>
+<div role="button" tabindex="0" aria-pressed="true">Pressed.</div>
     exists: true
-    label: FIXME: Pressed is false. Expected true. http://webkit.org/b/129830
+    label: Pressed.
     role: 
     focused: false
     parentNodeId: exists
-    pressed: false
+    pressed: true
     required: false
 
 <div role="button" tabindex="0" aria-disabled="true">disabled</div>
index e9f5d18..6f4e07a 100644 (file)
@@ -41,7 +41,7 @@
 
 <div class="ex" role="button" tabindex="0"></div>
 <div class="ex" role="button" tabindex="0" aria-disabled="true">disabled</div>
-<div class="ex" role="button" tabindex="0" aria-pressed="true">FIXME: Pressed is false. Expected true. http://webkit.org/b/129830</div>
+<div class="ex" role="button" tabindex="0" aria-pressed="true">Pressed.</div>
 <div class="ex" role="button" tabindex="0" aria-pressed="false">Not Pressed.</div>
 <button class="ex"></button>
 <input class="ex" type="button">
index 4575340..1e55e62 100644 (file)
@@ -1,3 +1,28 @@
+2015-06-12  Chris Fleizach  <cfleizach@apple.com>
+
+        AX:ARIA Toggle buttons aren't properly conveyed on iOS using VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=145949
+
+        Reviewed by Darin Adler.
+
+        Expose pressed state information to the iOS platform AX API.
+
+        Test: Updated inspector-protocol/dom/getAccessibilityPropertiesForNode.html 
+              There was a FIXME for this issue in that test: https://bugs.webkit.org/show_bug.cgi?id=129830
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::isPressed):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::classList):
+        (WebCore::AccessibilityObject::supportsARIAPressed):
+        (WebCore::AccessibilityObject::supportsARIAExpanded):
+        * accessibility/AccessibilityObject.h:
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityARIALiveRegionIsAtomic]):
+        (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAPressed]):
+        (-[WebAccessibilityObjectWrapper accessibilityIsPressed]):
+        (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):
+
 2015-06-12  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Purge PassRefPtr in JavaScriptCore - 2
index ee32bee..58c851f 100644 (file)
@@ -693,7 +693,8 @@ bool AccessibilityNodeObject::isPressed() const
         return false;
 
     // If this is an ARIA button, check the aria-pressed attribute rather than node()->active()
-    if (ariaRoleAttribute() == ButtonRole) {
+    AccessibilityRole ariaRole = ariaRoleAttribute();
+    if (ariaRole == ButtonRole || ariaRole == ToggleButtonRole) {
         if (equalIgnoringCase(getAttribute(aria_pressedAttr), "true"))
             return true;
         return false;
index 0b4e115..023e895 100644 (file)
@@ -2213,6 +2213,11 @@ void AccessibilityObject::classList(Vector<String>& classList) const
         classList.append(list.item(k).string());
 }
 
+bool AccessibilityObject::supportsARIAPressed() const
+{
+    const AtomicString& expanded = getAttribute(aria_pressedAttr);
+    return equalIgnoringCase(expanded, "true") || equalIgnoringCase(expanded, "false");
+}
     
 bool AccessibilityObject::supportsARIAExpanded() const
 {
index bb926b4..45d7bc1 100644 (file)
@@ -606,6 +606,7 @@ public:
     bool ariaPressedIsPresent() const;
     bool ariaIsMultiline() const;
     String invalidStatus() const;
+    bool supportsARIAPressed() const;
     bool supportsARIAExpanded() const;
     bool supportsChecked() const;
     AccessibilitySortDirection sortDirection() const;
index 81d9e47..307071b 100644 (file)
@@ -2300,6 +2300,22 @@ static void AXAttributedStringAppendText(NSMutableAttributedString* attrString,
     return m_object->ariaLiveRegionAtomic();
 }
 
+- (BOOL)accessibilitySupportsARIAPressed
+{
+    if (![self _prepareAccessibilityCall])
+        return NO;
+    
+    return m_object->supportsARIAPressed();
+}
+
+- (BOOL)accessibilityIsPressed
+{
+    if (![self _prepareAccessibilityCall])
+        return NO;
+    
+    return m_object->isPressed();
+}
+
 - (BOOL)accessibilitySupportsARIAExpanded
 {
     if (![self _prepareAccessibilityCall])