Title: [206259] trunk
Revision
206259
Author
n_w...@apple.com
Date
2016-09-22 08:14:27 -0700 (Thu, 22 Sep 2016)

Log Message

AX: aria-pressed state not correctly conveyed to VoiceOver iOS on <button> unless role=button added
https://bugs.webkit.org/show_bug.cgi?id=162269

Reviewed by Chris Fleizach.

Source/WebCore:

<button> with aria-pressed attribute has a toggle button role, however, we were looking for explicit
roles in order to convey the aria-press state. Since there's no spec requiring authors explicitly defining
default ARIA semantics in such case, I'm exposing the aria-pressed state for all valid toggle buttons.

Changes are covered in modified test.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isPressed):

LayoutTests:

Added test cases and also fixed a wrong expected output.

* accessibility/ios-simulator/aria-pressed-state-expected.txt:
* accessibility/ios-simulator/aria-pressed-state.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206258 => 206259)


--- trunk/LayoutTests/ChangeLog	2016-09-22 14:15:08 UTC (rev 206258)
+++ trunk/LayoutTests/ChangeLog	2016-09-22 15:14:27 UTC (rev 206259)
@@ -1,3 +1,15 @@
+2016-09-22  Nan Wang  <n_w...@apple.com>
+
+        AX: aria-pressed state not correctly conveyed to VoiceOver iOS on <button> unless role=button added
+        https://bugs.webkit.org/show_bug.cgi?id=162269
+
+        Reviewed by Chris Fleizach.
+
+        Added test cases and also fixed a wrong expected output.
+
+        * accessibility/ios-simulator/aria-pressed-state-expected.txt:
+        * accessibility/ios-simulator/aria-pressed-state.html:
+
 2016-09-22  Youenn Fablet  <you...@apple.com>
 
         CachedResourceRequest should store a SecurityOrigin

Modified: trunk/LayoutTests/accessibility/ios-simulator/aria-pressed-state-expected.txt (206258 => 206259)


--- trunk/LayoutTests/accessibility/ios-simulator/aria-pressed-state-expected.txt	2016-09-22 14:15:08 UTC (rev 206258)
+++ trunk/LayoutTests/accessibility/ios-simulator/aria-pressed-state-expected.txt	2016-09-22 15:14:27 UTC (rev 206259)
@@ -1,11 +1,14 @@
 button 1
 button 2
+button3 button4
 This test thats aria-pressed changes the traits returned by buttons
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-FAIL btn1.iphoneTraits != btn2.iphoneTraits should be true. Was false.
+PASS btn1.traits != btn2.traits is true
+PASS btn3.stringValue is 'AXValue: 1'
+PASS btn4.stringValue is 'AXValue: 1'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/ios-simulator/aria-pressed-state.html (206258 => 206259)


--- trunk/LayoutTests/accessibility/ios-simulator/aria-pressed-state.html	2016-09-22 14:15:08 UTC (rev 206258)
+++ trunk/LayoutTests/accessibility/ios-simulator/aria-pressed-state.html	2016-09-22 15:14:27 UTC (rev 206259)
@@ -11,8 +11,10 @@
 <body>
 
 <div id="button1" tabindex=0 role="button" aria-pressed="true">button 1</div>
-<div id="button2" tabindex=0 role="button" aria-pressed="false">button 2</div>
+<div id="button2" tabindex=0 role="button">button 2</div>
 
+<button id="button3" role="button" aria-pressed="true">button3</button>
+<button id="button4" aria-pressed="true">button4</button>
 
 <p id="description"></p>
 <div id="console"></div>
@@ -29,7 +31,13 @@
         document.getElementById("button2").focus();
         var btn2 = accessibilityController.focusedElement;
  
-        shouldBe("btn1.iphoneTraits != btn2.iphoneTraits", "true");
+        shouldBeTrue("btn1.traits != btn2.traits");
+        
+        // Make sure aria-press value is exposed correctly with native button tags.
+        var btn3 = accessibilityController.accessibleElementById("button3");
+        shouldBe("btn3.stringValue", "'AXValue: 1'");
+        var btn4 = accessibilityController.accessibleElementById("button4");
+        shouldBe("btn4.stringValue", "'AXValue: 1'");
     }
 
     successfullyParsed = true;

Modified: trunk/LayoutTests/accessibility/ios-simulator/toggle-button-expected.txt (206258 => 206259)


--- trunk/LayoutTests/accessibility/ios-simulator/toggle-button-expected.txt	2016-09-22 14:15:08 UTC (rev 206258)
+++ trunk/LayoutTests/accessibility/ios-simulator/toggle-button-expected.txt	2016-09-22 15:14:27 UTC (rev 206259)
@@ -7,7 +7,7 @@
 Button1 : AXLabel: Bold
 Button1 : AXValue: 
 Button2 : AXLabel: Italic
-Button2 : AXValue: 
+Button2 : AXValue: 1
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/Source/WebCore/ChangeLog (206258 => 206259)


--- trunk/Source/WebCore/ChangeLog	2016-09-22 14:15:08 UTC (rev 206258)
+++ trunk/Source/WebCore/ChangeLog	2016-09-22 15:14:27 UTC (rev 206259)
@@ -1,3 +1,19 @@
+2016-09-22  Nan Wang  <n_w...@apple.com>
+
+        AX: aria-pressed state not correctly conveyed to VoiceOver iOS on <button> unless role=button added
+        https://bugs.webkit.org/show_bug.cgi?id=162269
+
+        Reviewed by Chris Fleizach.
+
+        <button> with aria-pressed attribute has a toggle button role, however, we were looking for explicit
+        roles in order to convey the aria-press state. Since there's no spec requiring authors explicitly defining
+        default ARIA semantics in such case, I'm exposing the aria-pressed state for all valid toggle buttons.
+
+        Changes are covered in modified test.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::isPressed):
+
 2016-09-22  Anders Carlsson  <ander...@apple.com>
 
         Attempt to fix the open source iOS build.

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (206258 => 206259)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2016-09-22 14:15:08 UTC (rev 206258)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2016-09-22 15:14:27 UTC (rev 206259)
@@ -677,13 +677,9 @@
     if (!node)
         return false;
 
-    // If this is an ARIA button, check the aria-pressed attribute rather than node()->active()
-    AccessibilityRole ariaRole = ariaRoleAttribute();
-    if (ariaRole == ButtonRole || ariaRole == ToggleButtonRole) {
-        if (equalLettersIgnoringASCIICase(getAttribute(aria_pressedAttr), "true"))
-            return true;
-        return false;
-    }
+    // If this is an toggle button, check the aria-pressed attribute rather than node()->active()
+    if (isToggleButton())
+        return equalLettersIgnoringASCIICase(getAttribute(aria_pressedAttr), "true");
 
     if (!is<Element>(*node))
         return false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to