AX: iOS Voiceover does not announce previously selected value from input type="date...
authorn_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Oct 2016 17:18:19 +0000 (17:18 +0000)
committern_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Oct 2016 17:18:19 +0000 (17:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164176

Reviewed by Chris Fleizach.

Source/WebCore:

Input type date is a popup button on iOS and its value was not exposed in stringValue() since
it's not considered a text control. Instead, the value was exposed in AXTitle. Fixed this by adding
the case in stringValue() and removing the AXTitle exposure.

Changes are covered in modified test.

* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::stringValue):
* accessibility/ios/AccessibilityObjectIOS.mm:
(WebCore::AccessibilityObject::isInputTypePopupButton):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityLabel]):

LayoutTests:

* accessibility/ios-simulator/input-type-time-expected.txt:
* accessibility/ios-simulator/input-type-time.html:

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

LayoutTests/ChangeLog
LayoutTests/accessibility/ios-simulator/input-type-time-expected.txt
LayoutTests/accessibility/ios-simulator/input-type-time.html
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

index 3c1ef00..0110856 100644 (file)
@@ -1,3 +1,13 @@
+2016-10-31  Nan Wang  <n_wang@apple.com>
+
+        AX: iOS Voiceover does not announce previously selected value from input type="date" form field
+        https://bugs.webkit.org/show_bug.cgi?id=164176
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/input-type-time-expected.txt:
+        * accessibility/ios-simulator/input-type-time.html:
+
 2016-10-31  Jer Noble  <jer.noble@apple.com>
 
         REGRESSION (r206300): LayoutTest media/media-source/media-source-duplicate-seeked.html timing out
index 01b823e..36257cc 100644 (file)
@@ -1,4 +1,4 @@
-
 This tests that input type: time is accessible on iOS.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -6,6 +6,9 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 PASS timeinput.description is 'AXLabel: (Between: 07:00 AM-09:00 AM)'
 PASS timeinput.isIgnored is false
+PASS timeinput.stringValue is 'AXValue: 8:00 AM'
+PASS timeinput2.description is 'AXLabel: '
+PASS timeinput2.stringValue is 'AXValue: 8:00 AM'
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 7487a81..9ae66f2 100644 (file)
@@ -8,7 +8,8 @@ var successfullyParsed = false;
 </head>
 <body id="body">
 
-<input id="timeinput" type="time" aria-label="(Between: 07:00 AM-09:00 AM)" min="07:00" max="09:00" step="300" placeholder="00:00 AM">
+<input id="timeinput" type="time" aria-label="(Between: 07:00 AM-09:00 AM)" min="07:00" max="09:00" step="300" placeholder="00:00 AM" value="08:00">
+<input id="timeinput2" type="time" min="07:00" max="09:00" step="300" value="08:00">
 
 <p id="description"></p>
 <div id="console"></div>
@@ -20,8 +21,14 @@ var successfullyParsed = false;
     if (window.accessibilityController) {
 
         var timeinput = accessibilityController.accessibleElementById("timeinput");
+        var timeinput2 = accessibilityController.accessibleElementById("timeinput2");
         shouldBe("timeinput.description", "'AXLabel: (Between: 07:00 AM-09:00 AM)'");
         shouldBeFalse("timeinput.isIgnored");
+        
+        // Test value is exposed in AXValue.
+        shouldBe("timeinput.stringValue", "'AXValue: 8:00 AM'");
+        shouldBe("timeinput2.description", "'AXLabel: '");
+        shouldBe("timeinput2.stringValue", "'AXValue: 8:00 AM'");
     }
 
     successfullyParsed = true;
index 911e945..5cd95d4 100644 (file)
@@ -1,3 +1,24 @@
+2016-10-31  Nan Wang  <n_wang@apple.com>
+
+        AX: iOS Voiceover does not announce previously selected value from input type="date" form field
+        https://bugs.webkit.org/show_bug.cgi?id=164176
+
+        Reviewed by Chris Fleizach.
+
+        Input type date is a popup button on iOS and its value was not exposed in stringValue() since
+        it's not considered a text control. Instead, the value was exposed in AXTitle. Fixed this by adding
+        the case in stringValue() and removing the AXTitle exposure.
+
+        Changes are covered in modified test.
+
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::stringValue):
+        * accessibility/ios/AccessibilityObjectIOS.mm:
+        (WebCore::AccessibilityObject::isInputTypePopupButton):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityLabel]):
+
 2016-10-31  Simon Fraser  <simon.fraser@apple.com>
 
         Add requestIdleCallback to features.json.
index 3c95473..0a520d9 100644 (file)
@@ -1042,6 +1042,7 @@ public:
 #if PLATFORM(IOS)
     int accessibilityPasswordFieldLength();
     bool hasTouchEventListener() const;
+    bool isInputTypePopupButton() const;
 #endif
     
     // allows for an AccessibilityObject to update its render tree or perform
index a9c57c7..5dcef98 100644 (file)
@@ -776,6 +776,11 @@ String AccessibilityRenderObject::stringValue() const
     if (isTextControl())
         return text();
     
+#if PLATFORM(IOS)
+    if (isInputTypePopupButton())
+        return textUnderElement();
+#endif
+    
     if (is<RenderFileUploadControl>(*m_renderer))
         return downcast<RenderFileUploadControl>(*m_renderer).fileTextValue();
     
index 21c4941..d8abbd3 100644 (file)
@@ -90,6 +90,13 @@ bool AccessibilityObject::hasTouchEventListener() const
     }
     return false;
 }
+    
+bool AccessibilityObject::isInputTypePopupButton() const
+{
+    if (is<HTMLInputElement>(node()))
+        return roleValue() == PopUpButtonRole;
+    return false;
+}
 
 } // WebCore
 
index 6b440f7..a8586a8 100644 (file)
@@ -997,6 +997,10 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
     NSString *axTitle = [self baseAccessibilityTitle];
     NSString *axDescription = [self baseAccessibilityDescription];
     NSString *landmarkDescription = [self ariaLandmarkRoleDescription];
+    
+    // We should expose the value of the input type date or time through AXValue instead of AXTitle.
+    if (m_object->isInputTypePopupButton() && [axTitle isEqualToString:[self accessibilityValue]])
+        axTitle = nil;
 
     // Footer is not considered a landmark, but we want the role description.
     if (m_object->roleValue() == FooterRole)