Commit ff8fc1dd authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

Fix two issues with date/time input accessibility on Android.

Android uses somewhat different date/time pickers. They look like spinners.
The first bug was that they didn't expose their accessible name and value.
Fixed by whitelisting those roles as roles that need to expose a value on
Android, and added test coverage.

The second bug was that the value wasn't being updated. This change adds a
call to fire a ValueChanged event to the right Blink code.

Bug: 998119, 998121
Change-Id: Ibee5778c3afc532bdd145eeb7d5f4646287fc383
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1790466
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694917}
parent f278f715
......@@ -1665,8 +1665,11 @@ bool BrowserAccessibilityAndroid::IsIframe() const {
bool BrowserAccessibilityAndroid::ShouldExposeValueAsName() const {
switch (GetRole()) {
case ax::mojom::Role::kDate:
case ax::mojom::Role::kDateTime:
case ax::mojom::Role::kTextField:
case ax::mojom::Role::kTextFieldWithComboBox:
case ax::mojom::Role::kTime:
return true;
default:
break;
......
android.webkit.WebView focusable focused scrollable
++android.view.View
++++android.widget.Spinner role_description='date picker' clickable focusable name='2008-09-01' input_type=20
++++android.widget.Spinner role_description='date picker' clickable focusable name='2008-09-01' hint='When' input_type=20
\ No newline at end of file
......@@ -12,3 +12,15 @@
++++++++++[spin button] name='Year' current=2008.000000 minimum=1.000000 maximum=275760.000000
++++++++++++[text] name='2008'
++++++[push button] name='Show date picker'
++++[dateeditor] name='When'
++++++[section]
++++++++[section]
++++++++++[spin button] name='Month When' current=9.000000 minimum=1.000000 maximum=12.000000
++++++++++++[text] name='09'
++++++++++[text] name='/'
++++++++++[spin button] name='Day When' current=1.000000 minimum=1.000000 maximum=31.000000
++++++++++++[text] name='01'
++++++++++[text] name='/'
++++++++++[spin button] name='Year When' current=2008.000000 minimum=1.000000 maximum=275760.000000
++++++++++++[text] name='2008'
++++++[push button] name='Show date picker'
\ No newline at end of file
......@@ -17,3 +17,20 @@ rootWebArea
++++++++++++staticText name='2008'
++++++++++++++inlineTextBox name='2008'
++++++popUpButton name='Show date picker'
++++date inputType='date' name='When' value='2008-09-01'
++++++genericContainer
++++++++genericContainer
++++++++++spinButton name='Month When' value='09' valueForRange=9.00 minValueForRange=1.00 maxValueForRange=12.00
++++++++++++staticText name='09'
++++++++++++++inlineTextBox name='09'
++++++++++staticText name='/'
++++++++++++inlineTextBox name='/'
++++++++++spinButton name='Day When' value='01' valueForRange=1.00 minValueForRange=1.00 maxValueForRange=31.00
++++++++++++staticText name='01'
++++++++++++++inlineTextBox name='01'
++++++++++staticText name='/'
++++++++++++inlineTextBox name='/'
++++++++++spinButton name='Year When' value='2008' valueForRange=2008.00 minValueForRange=1.00 maxValueForRange=275760.00
++++++++++++staticText name='2008'
++++++++++++++inlineTextBox name='2008'
++++++popUpButton name='Show date picker'
\ No newline at end of file
......@@ -12,3 +12,15 @@ AXWebArea AXRoleDescription='HTML content'
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='2008' AXDescription='Year'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='2008'
++++++AXPopUpButton AXRoleDescription='pop up button' AXDescription='Show date picker'
++++AXDateField AXRoleDescription='date field' AXValue='2008-09-01' AXDescription='When'
++++++AXGroup AXRoleDescription='group'
++++++++AXGroup AXRoleDescription='group'
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='9' AXDescription='Month When'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='09'
++++++++++AXStaticText AXRoleDescription='text' AXValue='/'
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='1' AXDescription='Day When'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='01'
++++++++++AXStaticText AXRoleDescription='text' AXValue='/'
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='2008' AXDescription='Year When'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='2008'
++++++AXPopUpButton AXRoleDescription='pop up button' AXDescription='Show date picker'
\ No newline at end of file
......@@ -12,3 +12,15 @@ document
++++++++++spinbutton Name='Year' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=275760.00 RangeValue.Minimum=1.00 RangeValue.Value=2008.00 Value.Value='2008'
++++++++++++description Name='2008'
++++++menu Name='Show date picker' ExpandCollapse.ExpandCollapseState='LeafNode'
++++textbox LocalizedControlType='date picker' Name='When'
++++++group
++++++++group
++++++++++spinbutton Name='Month When' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=12.00 RangeValue.Minimum=1.00 RangeValue.Value=9.00 Value.Value='09'
++++++++++++description Name='09'
++++++++++description Name='/'
++++++++++spinbutton Name='Day When' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=31.00 RangeValue.Minimum=1.00 RangeValue.Value=1.00 Value.Value='01'
++++++++++++description Name='01'
++++++++++description Name='/'
++++++++++spinbutton Name='Year When' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=275760.00 RangeValue.Minimum=1.00 RangeValue.Value=2008.00 Value.Value='2008'
++++++++++++description Name='2008'
++++++menu Name='Show date picker' ExpandCollapse.ExpandCollapseState='LeafNode'
\ No newline at end of file
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0><obj1>'
++++IA2_ROLE_DATE_EDITOR value='2008-09-01' FOCUSABLE ia2_hypertext='<obj0><obj1>' localized_extended_role='date picker'
++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>/<obj2>/<obj4>'
......@@ -12,3 +12,15 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++++++++++ROLE_SYSTEM_SPINBUTTON name='Year' value='2008' FOCUSABLE ia2_hypertext='2008'
++++++++++++ROLE_SYSTEM_STATICTEXT name='2008' ia2_hypertext='2008'
++++++ROLE_SYSTEM_BUTTONMENU name='Show date picker' FOCUSABLE HASPOPUP ia2_hypertext='Show date picker'
++++IA2_ROLE_DATE_EDITOR name='When' value='2008-09-01' FOCUSABLE ia2_hypertext='<obj0><obj1>' localized_extended_role='date picker'
++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>/<obj2>/<obj4>'
++++++++++ROLE_SYSTEM_SPINBUTTON name='Month When' value='09' FOCUSABLE ia2_hypertext='09'
++++++++++++ROLE_SYSTEM_STATICTEXT name='09' ia2_hypertext='09'
++++++++++ROLE_SYSTEM_STATICTEXT name='/' ia2_hypertext='/'
++++++++++ROLE_SYSTEM_SPINBUTTON name='Day When' value='01' FOCUSABLE ia2_hypertext='01'
++++++++++++ROLE_SYSTEM_STATICTEXT name='01' ia2_hypertext='01'
++++++++++ROLE_SYSTEM_STATICTEXT name='/' ia2_hypertext='/'
++++++++++ROLE_SYSTEM_SPINBUTTON name='Year When' value='2008' FOCUSABLE ia2_hypertext='2008'
++++++++++++ROLE_SYSTEM_STATICTEXT name='2008' ia2_hypertext='2008'
++++++ROLE_SYSTEM_BUTTONMENU name='Show date picker' FOCUSABLE HASPOPUP ia2_hypertext='Show date picker'
\ No newline at end of file
......@@ -9,5 +9,6 @@
<html>
<body>
<input type="date" value="2008-09-01">
<input type="date" value="2008-09-01" aria-label="When">
</body>
</html>
android.webkit.WebView focusable focused scrollable
++android.view.View
++++android.widget.EditText clickable editable_text focusable has_non_empty_value name='1/1/2015 1:00AM' input_type=4 text_change_added_count=15
++++android.widget.EditText clickable editable_text focusable has_non_empty_value name='1/1/2015 1:00AM' hint='Launch' input_type=4 text_change_added_count=15
\ No newline at end of file
[document web] focusable focused
++[section]
++++[entry] editable focusable selectable-text text-input-type:datetime
++++[entry] name='Launch' editable focusable selectable-text text-input-type:datetime
\ No newline at end of file
......@@ -4,3 +4,7 @@ rootWebArea
++++++genericContainer
++++++++staticText name='1/1/2015 1:00AM'
++++++++++inlineTextBox name='1/1/2015 1:00AM'
++++textField inputType='datetime' name='Launch' value='1/1/2015 1:00AM'
++++++genericContainer
++++++++staticText name='1/1/2015 1:00AM'
++++++++++inlineTextBox name='1/1/2015 1:00AM'
\ No newline at end of file
AXWebArea AXRoleDescription='HTML content'
++AXGroup AXRoleDescription='group'
++++AXTextField AXRoleDescription='text field' AXValue='1/1/2015 1:00AM'
++++AXTextField AXRoleDescription='text field' AXValue='1/1/2015 1:00AM' AXDescription='Launch'
\ No newline at end of file
document
++group
++++textbox Value.Value='1/1/2015 1:00AM'
++++textbox Name='Launch' Value.Value='1/1/2015 1:00AM'
\ No newline at end of file
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0><obj1>'
++++ROLE_SYSTEM_TEXT value='1/1/2015 1:00AM' FOCUSABLE ia2_hypertext='1/1/2015 1:00AM'
++++ROLE_SYSTEM_TEXT name='Launch' value='1/1/2015 1:00AM' FOCUSABLE ia2_hypertext='1/1/2015 1:00AM'
\ No newline at end of file
......@@ -11,5 +11,6 @@
<html>
<body>
<input type="datetime" value="1/1/2015 1:00AM">
<input type="datetime" value="1/1/2015 1:00AM" aria-label="Launch">
</body>
</html>
android.webkit.WebView focusable focused scrollable
++android.view.View
++++android.widget.Spinner role_description='time picker' clickable focusable name='00:00:00' input_type=36
++++android.widget.Spinner role_description='time picker' clickable focusable name='Breakfast' input_type=36
\ No newline at end of file
......@@ -11,3 +11,14 @@
++++++++++[text] name=' '
++++++++++[spin button] name='AM/PM' xml-roles:spinbutton current=1.000000 minimum=1.000000 maximum=2.000000
++++++++++++[text] name='AM'
++++[dateeditor] name='Breakfast'
++++++[section]
++++++++[section]
++++++++++[spin button] name='Hours Breakfast' xml-roles:spinbutton current=12.000000 minimum=1.000000 maximum=12.000000
++++++++++++[text] name='12'
++++++++++[text] name=':'
++++++++++[spin button] name='Minutes Breakfast' xml-roles:spinbutton current=0.000000 minimum=0.000000 maximum=59.000000
++++++++++++[text] name='00'
++++++++++[text] name=' '
++++++++++[spin button] name='AM/PM Breakfast' xml-roles:spinbutton current=1.000000 minimum=1.000000 maximum=2.000000
++++++++++++[text] name='AM'
\ No newline at end of file
......@@ -16,3 +16,19 @@ rootWebArea
++++++++++spinButton name='AM/PM' value='AM' valueForRange=1.00 minValueForRange=1.00 maxValueForRange=2.00
++++++++++++staticText name='AM'
++++++++++++++inlineTextBox name='AM'
++++inputTime inputType='time' name='Breakfast' value='00:00:00'
++++++genericContainer
++++++++genericContainer
++++++++++spinButton name='Hours Breakfast' value='12' valueForRange=12.00 minValueForRange=1.00 maxValueForRange=12.00
++++++++++++staticText name='12'
++++++++++++++inlineTextBox name='12'
++++++++++staticText name=':'
++++++++++++inlineTextBox name=':'
++++++++++spinButton name='Minutes Breakfast' value='00' valueForRange=0.00 minValueForRange=0.00 maxValueForRange=59.00
++++++++++++staticText name='00'
++++++++++++++inlineTextBox name='00'
++++++++++staticText name=' '
++++++++++++inlineTextBox name=' '
++++++++++spinButton name='AM/PM Breakfast' value='AM' valueForRange=1.00 minValueForRange=1.00 maxValueForRange=2.00
++++++++++++staticText name='AM'
++++++++++++++inlineTextBox name='AM'
\ No newline at end of file
......@@ -11,3 +11,14 @@ AXWebArea AXRoleDescription='HTML content'
++++++++++AXStaticText AXRoleDescription='text' AXValue=' '
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='1' AXDescription='AM/PM'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='AM'
++++AXTimeField AXRoleDescription='time field' AXValue='00:00:00' AXDescription='Breakfast'
++++++AXGroup AXRoleDescription='group'
++++++++AXGroup AXRoleDescription='group'
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='12' AXDescription='Hours Breakfast'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='12'
++++++++++AXStaticText AXRoleDescription='text' AXValue=':'
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXDescription='Minutes Breakfast'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='00'
++++++++++AXStaticText AXRoleDescription='text' AXValue=' '
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='1' AXDescription='AM/PM Breakfast'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='AM'
\ No newline at end of file
......@@ -11,3 +11,14 @@ document
++++++++++description Name=' '
++++++++++spinbutton Name='AM/PM' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=2.00 RangeValue.Minimum=1.00 RangeValue.Value=1.00 Value.Value='AM'
++++++++++++description Name='AM'
++++group Name='Breakfast'
++++++group
++++++++group
++++++++++spinbutton Name='Hours Breakfast' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=12.00 RangeValue.Minimum=1.00 RangeValue.Value=12.00 Value.Value='12'
++++++++++++description Name='12'
++++++++++description Name=':'
++++++++++spinbutton Name='Minutes Breakfast' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=59.00 RangeValue.Minimum=0.00 RangeValue.Value=0.00 Value.Value='00'
++++++++++++description Name='00'
++++++++++description Name=' '
++++++++++spinbutton Name='AM/PM Breakfast' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=2.00 RangeValue.Minimum=1.00 RangeValue.Value=1.00 Value.Value='AM'
++++++++++++description Name='AM'
\ No newline at end of file
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0><obj1>'
++++ROLE_SYSTEM_GROUPING value='00:00:00' FOCUSABLE ia2_hypertext='<obj0>'
++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>:<obj2> <obj4>'
......@@ -11,3 +11,14 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++++++++++ROLE_SYSTEM_STATICTEXT name=' ' ia2_hypertext=' '
++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM' value='AM' FOCUSABLE xml-roles:spinbutton ia2_hypertext='AM'
++++++++++++ROLE_SYSTEM_STATICTEXT name='AM' ia2_hypertext='AM'
++++ROLE_SYSTEM_GROUPING name='Breakfast' value='00:00:00' FOCUSABLE ia2_hypertext='<obj0>'
++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>:<obj2> <obj4>'
++++++++++ROLE_SYSTEM_SPINBUTTON name='Hours Breakfast' value='12' FOCUSABLE xml-roles:spinbutton ia2_hypertext='12'
++++++++++++ROLE_SYSTEM_STATICTEXT name='12' ia2_hypertext='12'
++++++++++ROLE_SYSTEM_STATICTEXT name=':' ia2_hypertext=':'
++++++++++ROLE_SYSTEM_SPINBUTTON name='Minutes Breakfast' value='00' FOCUSABLE xml-roles:spinbutton ia2_hypertext='00'
++++++++++++ROLE_SYSTEM_STATICTEXT name='00' ia2_hypertext='00'
++++++++++ROLE_SYSTEM_STATICTEXT name=' ' ia2_hypertext=' '
++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM Breakfast' value='AM' FOCUSABLE xml-roles:spinbutton ia2_hypertext='AM'
++++++++++++ROLE_SYSTEM_STATICTEXT name='AM' ia2_hypertext='AM'
\ No newline at end of file
......@@ -11,5 +11,6 @@
<html>
<body>
<input type="time" value="00:00:00">
<input type="time" value="00:00:00" aria-label="Breakfast">
</body>
</html>
android.webkit.WebView focusable focused scrollable
++android.view.View
++++android.view.View role_description='time' name='10:00'
++++android.view.View role_description='time'
++++android.view.View name=' '
++++android.view.View role_description='time' name='Valentines day'
\ No newline at end of file
++++android.view.View role_description='time'
\ No newline at end of file
......@@ -26,6 +26,7 @@
#include "third_party/blink/renderer/core/html/forms/external_date_time_chooser.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/forms/date_time_chooser_client.h"
#include "third_party/blink/renderer/core/input_type_names.h"
......@@ -117,9 +118,20 @@ mojom::blink::DateTimeChooser& ExternalDateTimeChooser::GetDateTimeChooser(
}
void ExternalDateTimeChooser::DidChooseValue(double value) {
// Cache the owner element first, because DidChooseValue might run
// JavaScript code and destroy |client|.
Element* element = client_ ? &client_->OwnerElement() : nullptr;
if (client_)
client_->DidChooseValue(value);
// didChooseValue might run JavaScript code, and endChooser() might be
// Post an accessibility event on the owner element to indicate the
// value changed.
if (element) {
if (AXObjectCache* cache = element->GetDocument().ExistingAXObjectCache())
cache->HandleValueChanged(element);
}
// DidChooseValue might run JavaScript code, and endChooser() might be
// called. However DateTimeChooserCompletionImpl still has one reference to
// this object.
if (client_)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment