Commit 1e28a640 authored by Daniel Clark's avatar Daniel Clark Committed by Commit Bot

Give date/time control picker indicator elements more specific aria-labels

Prior to this change the picker indicator element (the element inside
the control's text box that can be clicked on to open the popup) for
date, time, datetime-local, week, and month input controls all had an
aria-label of "show date picker".  This change updates the picker
indicator's aria-label for each of these control types so that it
actually corresponds to the control type ("show time picker", etc).

Bug: 1026537
Change-Id: Id93ea60e6481d3996b5c663ff8b1a3baf703a168
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2052608Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Dan Clark <daniec@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#741683}
parent 47289d62
...@@ -20,4 +20,4 @@ ...@@ -20,4 +20,4 @@
++++++++++[static] name=' ' ++++++++++[static] name=' '
++++++++++[spin button] name='AM/PM' current=0.000000 minimum=1.000000 maximum=2.000000 ++++++++++[spin button] name='AM/PM' current=0.000000 minimum=1.000000 maximum=2.000000
++++++++++++[static] name='--' ++++++++++++[static] name='--'
++++++[push button] name='Show date picker' haspopup:menu ++++++[push button] name='Show local date and time picker' haspopup:menu
...@@ -20,5 +20,5 @@ document ...@@ -20,5 +20,5 @@ document
++++++++++description Name=' ' ++++++++++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=0.00 Value.Value='0' ++++++++++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=0.00 Value.Value='0'
++++++++++++description Name='--' ++++++++++++description Name='--'
++++++button Name='Show date picker' ExpandCollapse.ExpandCollapseState='Collapsed' ++++++button Name='Show local date and time picker' ExpandCollapse.ExpandCollapseState='Collapsed'
<-- End-of-file --> <-- End-of-file -->
...@@ -20,4 +20,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' ...@@ -20,4 +20,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++++++++++ROLE_SYSTEM_STATICTEXT name=' ' ia2_hypertext=' ' ++++++++++ROLE_SYSTEM_STATICTEXT name=' ' ia2_hypertext=' '
++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM' value='0' FOCUSABLE ia2_hypertext='--' ++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM' value='0' FOCUSABLE ia2_hypertext='--'
++++++++++++ROLE_SYSTEM_STATICTEXT name='--' ia2_hypertext='--' ++++++++++++ROLE_SYSTEM_STATICTEXT name='--' ia2_hypertext='--'
++++++ROLE_SYSTEM_BUTTONMENU name='Show date picker' FOCUSABLE HASPOPUP haspopup:menu ia2_hypertext='Show date picker' ++++++ROLE_SYSTEM_BUTTONMENU name='Show local date and time picker' FOCUSABLE HASPOPUP haspopup:menu ia2_hypertext='Show local date and time picker'
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
++++++++++[static] name=' ' ++++++++++[static] name=' '
++++++++++[spin button] name='Year' valuetext:0 current=0.000000 minimum=1.000000 maximum=275760.000000 ++++++++++[spin button] name='Year' valuetext:0 current=0.000000 minimum=1.000000 maximum=275760.000000
++++++++++++[static] name='----' ++++++++++++[static] name='----'
++++++[push button] name='Show date picker' haspopup:menu ++++++[push button] name='Show month picker' haspopup:menu
...@@ -11,4 +11,4 @@ rootWebArea ...@@ -11,4 +11,4 @@ rootWebArea
++++++++++spinButton name='Year' valueForRange=0.00 minValueForRange=1.00 maxValueForRange=275760.00 ++++++++++spinButton name='Year' valueForRange=0.00 minValueForRange=1.00 maxValueForRange=275760.00
++++++++++++staticText name='----' ++++++++++++staticText name='----'
++++++++++++++inlineTextBox name='----' ++++++++++++++inlineTextBox name='----'
++++++popUpButton name='Show date picker' haspopup=menu ++++++popUpButton name='Show month picker' haspopup=menu
...@@ -8,4 +8,4 @@ AXWebArea AXRoleDescription='HTML content' ...@@ -8,4 +8,4 @@ AXWebArea AXRoleDescription='HTML content'
++++++++++AXStaticText AXRoleDescription='text' AXValue=' ' ++++++++++AXStaticText AXRoleDescription='text' AXValue=' '
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXDescription='Year' ++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXDescription='Year'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='----' ++++++++++++AXStaticText AXRoleDescription='text' AXValue='----'
++++++AXPopUpButton AXRoleDescription='pop up button' AXDescription='Show date picker' ++++++AXPopUpButton AXRoleDescription='pop up button' AXDescription='Show month picker'
\ No newline at end of file \ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
++++++++++[static] name=' ' ++++++++++[static] name=' '
++++++++++[spin button] name='AM/PM' xml-roles:spinbutton current=1.000000 minimum=1.000000 maximum=2.000000 ++++++++++[spin button] name='AM/PM' xml-roles:spinbutton current=1.000000 minimum=1.000000 maximum=2.000000
++++++++++++[static] name='AM' ++++++++++++[static] name='AM'
++++++[push button] name='Show date picker' xml-roles:button ++++++[push button] name='Show time picker' xml-roles:button
++++[dateeditor] name='Breakfast' ++++[dateeditor] name='Breakfast'
++++++[section] ++++++[section]
++++++++[section] ++++++++[section]
...@@ -23,4 +23,4 @@ ...@@ -23,4 +23,4 @@
++++++++++[static] name=' ' ++++++++++[static] name=' '
++++++++++[spin button] name='AM/PM Breakfast' xml-roles:spinbutton current=1.000000 minimum=1.000000 maximum=2.000000 ++++++++++[spin button] name='AM/PM Breakfast' xml-roles:spinbutton current=1.000000 minimum=1.000000 maximum=2.000000
++++++++++++[static] name='AM' ++++++++++++[static] name='AM'
++++++[push button] name='Show date picker' xml-roles:button ++++++[push button] name='Show time picker' xml-roles:button
...@@ -16,7 +16,7 @@ rootWebArea ...@@ -16,7 +16,7 @@ rootWebArea
++++++++++spinButton name='AM/PM' value='AM' valueForRange=1.00 minValueForRange=1.00 maxValueForRange=2.00 ++++++++++spinButton name='AM/PM' value='AM' valueForRange=1.00 minValueForRange=1.00 maxValueForRange=2.00
++++++++++++staticText name='AM' ++++++++++++staticText name='AM'
++++++++++++++inlineTextBox name='AM' ++++++++++++++inlineTextBox name='AM'
++++++popUpButton name='Show date picker' ++++++popUpButton name='Show time picker'
++++inputTime inputType='time' name='Breakfast' value='00:00:00' ++++inputTime inputType='time' name='Breakfast' value='00:00:00'
++++++genericContainer ++++++genericContainer
++++++++genericContainer ++++++++genericContainer
...@@ -33,4 +33,4 @@ rootWebArea ...@@ -33,4 +33,4 @@ rootWebArea
++++++++++spinButton name='AM/PM Breakfast' value='AM' valueForRange=1.00 minValueForRange=1.00 maxValueForRange=2.00 ++++++++++spinButton name='AM/PM Breakfast' value='AM' valueForRange=1.00 minValueForRange=1.00 maxValueForRange=2.00
++++++++++++staticText name='AM' ++++++++++++staticText name='AM'
++++++++++++++inlineTextBox name='AM' ++++++++++++++inlineTextBox name='AM'
++++++popUpButton name='Show date picker' ++++++popUpButton name='Show time picker'
...@@ -11,7 +11,7 @@ document ...@@ -11,7 +11,7 @@ document
++++++++++description Name=' ' ++++++++++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' ++++++++++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' ++++++++++++description Name='AM'
++++++button Name='Show date picker' ExpandCollapse.ExpandCollapseState='Collapsed' ++++++button Name='Show time picker' ExpandCollapse.ExpandCollapseState='Collapsed'
++++group Name='Breakfast' ++++group Name='Breakfast'
++++++group IsControlElement=false ++++++group IsControlElement=false
++++++++group IsControlElement=false ++++++++group IsControlElement=false
...@@ -23,5 +23,5 @@ document ...@@ -23,5 +23,5 @@ document
++++++++++description Name=' ' ++++++++++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' ++++++++++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' ++++++++++++description Name='AM'
++++++button Name='Show date picker' ExpandCollapse.ExpandCollapseState='Collapsed' ++++++button Name='Show time picker' ExpandCollapse.ExpandCollapseState='Collapsed'
<-- End-of-file --> <-- End-of-file -->
...@@ -11,7 +11,7 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' ...@@ -11,7 +11,7 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++++++++++ROLE_SYSTEM_STATICTEXT name=' ' ia2_hypertext=' ' ++++++++++ROLE_SYSTEM_STATICTEXT name=' ' ia2_hypertext=' '
++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM' value='AM' FOCUSABLE xml-roles:spinbutton ia2_hypertext='AM' ++++++++++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_STATICTEXT name='AM' ia2_hypertext='AM'
++++++ROLE_SYSTEM_BUTTONMENU name='Show date picker' FOCUSABLE HASPOPUP xml-roles:button ia2_hypertext='Show date picker' ++++++ROLE_SYSTEM_BUTTONMENU name='Show time picker' FOCUSABLE HASPOPUP xml-roles:button ia2_hypertext='Show time picker'
++++ROLE_SYSTEM_GROUPING name='Breakfast' value='00:00:00' FOCUSABLE ia2_hypertext='<obj0><obj1>' ++++ROLE_SYSTEM_GROUPING name='Breakfast' value='00:00:00' FOCUSABLE ia2_hypertext='<obj0><obj1>'
++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>' ++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>:<obj2> <obj4>' ++++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>:<obj2> <obj4>'
...@@ -23,4 +23,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' ...@@ -23,4 +23,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++++++++++ROLE_SYSTEM_STATICTEXT name=' ' ia2_hypertext=' ' ++++++++++ROLE_SYSTEM_STATICTEXT name=' ' ia2_hypertext=' '
++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM Breakfast' value='AM' FOCUSABLE xml-roles:spinbutton ia2_hypertext='AM' ++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM Breakfast' value='AM' FOCUSABLE xml-roles:spinbutton ia2_hypertext='AM'
++++++++++++ROLE_SYSTEM_STATICTEXT name='AM' ia2_hypertext='AM' ++++++++++++ROLE_SYSTEM_STATICTEXT name='AM' ia2_hypertext='AM'
++++++ROLE_SYSTEM_BUTTONMENU name='Show date picker' FOCUSABLE HASPOPUP xml-roles:button ia2_hypertext='Show date picker' ++++++ROLE_SYSTEM_BUTTONMENU name='Show time picker' FOCUSABLE HASPOPUP xml-roles:button ia2_hypertext='Show time picker'
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
++++++++++[static] name=', ' ++++++++++[static] name=', '
++++++++++[spin button] name='Year' current=0.000000 minimum=1.000000 maximum=275760.000000 ++++++++++[spin button] name='Year' current=0.000000 minimum=1.000000 maximum=275760.000000
++++++++++++[static] name='----' ++++++++++++[static] name='----'
++++++[push button] name='Show date picker' haspopup:menu ++++++[push button] name='Show week picker' haspopup:menu
...@@ -13,4 +13,4 @@ rootWebArea ...@@ -13,4 +13,4 @@ rootWebArea
++++++++++spinButton name='Year' valueForRange=0.00 minValueForRange=1.00 maxValueForRange=275760.00 ++++++++++spinButton name='Year' valueForRange=0.00 minValueForRange=1.00 maxValueForRange=275760.00
++++++++++++staticText name='----' ++++++++++++staticText name='----'
++++++++++++++inlineTextBox name='----' ++++++++++++++inlineTextBox name='----'
++++++popUpButton name='Show date picker' haspopup=menu ++++++popUpButton name='Show week picker' haspopup=menu
...@@ -9,4 +9,4 @@ AXWebArea AXRoleDescription='HTML content' ...@@ -9,4 +9,4 @@ AXWebArea AXRoleDescription='HTML content'
++++++++++AXStaticText AXRoleDescription='text' AXValue=', ' ++++++++++AXStaticText AXRoleDescription='text' AXValue=', '
++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXDescription='Year' ++++++++++AXIncrementor AXRoleDescription='stepper' AXValue='0' AXDescription='Year'
++++++++++++AXStaticText AXRoleDescription='text' AXValue='----' ++++++++++++AXStaticText AXRoleDescription='text' AXValue='----'
++++++AXPopUpButton AXRoleDescription='pop up button' AXDescription='Show date picker' ++++++AXPopUpButton AXRoleDescription='pop up button' AXDescription='Show week picker'
\ No newline at end of file \ No newline at end of file
...@@ -9,5 +9,5 @@ document ...@@ -9,5 +9,5 @@ document
++++++++++description Name=', ' ++++++++++description Name=', '
++++++++++spinbutton Name='Year' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=275760.00 RangeValue.Minimum=1.00 RangeValue.Value=0.00 Value.Value='0' ++++++++++spinbutton Name='Year' RangeValue.IsReadOnly=false RangeValue.LargeChange=0.00 RangeValue.SmallChange=0.00 RangeValue.Maximum=275760.00 RangeValue.Minimum=1.00 RangeValue.Value=0.00 Value.Value='0'
++++++++++++description Name='----' ++++++++++++description Name='----'
++++++button Name='Show date picker' ExpandCollapse.ExpandCollapseState='Collapsed' ++++++button Name='Show week picker' ExpandCollapse.ExpandCollapseState='Collapsed'
<-- End-of-file --> <-- End-of-file -->
...@@ -9,4 +9,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' ...@@ -9,4 +9,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
++++++++++ROLE_SYSTEM_STATICTEXT name=', ' ia2_hypertext=', ' ++++++++++ROLE_SYSTEM_STATICTEXT name=', ' ia2_hypertext=', '
++++++++++ROLE_SYSTEM_SPINBUTTON name='Year' value='0' FOCUSABLE ia2_hypertext='----' ++++++++++ROLE_SYSTEM_SPINBUTTON name='Year' value='0' FOCUSABLE ia2_hypertext='----'
++++++++++++ROLE_SYSTEM_STATICTEXT name='----' ia2_hypertext='----' ++++++++++++ROLE_SYSTEM_STATICTEXT name='----' ia2_hypertext='----'
++++++ROLE_SYSTEM_BUTTONMENU name='Show date picker' FOCUSABLE HASPOPUP haspopup:menu ia2_hypertext='Show date picker' ++++++ROLE_SYSTEM_BUTTONMENU name='Show week picker' FOCUSABLE HASPOPUP haspopup:menu ia2_hypertext='Show week picker'
...@@ -288,6 +288,19 @@ below: ...@@ -288,6 +288,19 @@ below:
<message name="IDS_AX_CALENDAR_SHOW_DATE_PICKER" desc="Accessible description of a button to show a calendar from a date input field."> <message name="IDS_AX_CALENDAR_SHOW_DATE_PICKER" desc="Accessible description of a button to show a calendar from a date input field.">
Show date picker Show date picker
</message> </message>
<message name="IDS_AX_CALENDAR_SHOW_DATE_TIME_LOCAL_PICKER" desc="Accessible description of a button to show a calendar and time chooser from a datetime-local input field.">
Show local date and time picker
</message>
<message name="IDS_AX_CALENDAR_SHOW_MONTH_PICKER" desc="Accessible description of a button to show a calendar from a month input field.">
Show month picker
</message>
<message name="IDS_AX_CALENDAR_SHOW_TIME_PICKER" desc="Accessible description of a button to show a time chooser from a time input field.">
Show time picker
</message>
<message name="IDS_AX_CALENDAR_SHOW_WEEK_PICKER" desc="Accessible description of a button to show a calendar from a week input field.">
Show week picker
</message>
<message name="IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR" desc="Accessible description of a button to show month selection panel in a calendar picker."> <message name="IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR" desc="Accessible description of a button to show month selection panel in a calendar picker.">
Show month selection panel Show month selection panel
</message> </message>
......
...@@ -69,6 +69,7 @@ class BaseTemporalInputType : public InputType { ...@@ -69,6 +69,7 @@ class BaseTemporalInputType : public InputType {
bool has_hour, bool has_hour,
bool has_minute, bool has_minute,
bool has_second) const = 0; bool has_second) const = 0;
virtual String AriaRoleForPickerIndicator() const = 0;
protected: protected:
BaseTemporalInputType(HTMLInputElement& element) : InputType(element) {} BaseTemporalInputType(HTMLInputElement& element) : InputType(element) {}
......
...@@ -134,4 +134,8 @@ bool DateInputType::IsValidFormat(bool has_year, ...@@ -134,4 +134,8 @@ bool DateInputType::IsValidFormat(bool has_year,
return has_year && has_month && has_day; return has_year && has_month && has_day;
} }
String DateInputType::AriaRoleForPickerIndicator() const {
return GetLocale().QueryString(IDS_AX_CALENDAR_SHOW_DATE_PICKER);
}
} // namespace blink } // namespace blink
...@@ -60,6 +60,7 @@ class DateInputType final : public BaseTemporalInputType { ...@@ -60,6 +60,7 @@ class DateInputType final : public BaseTemporalInputType {
bool has_hour, bool has_hour,
bool has_minute, bool has_minute,
bool has_second) const override; bool has_second) const override;
String AriaRoleForPickerIndicator() const override;
}; };
} // namespace blink } // namespace blink
......
...@@ -191,4 +191,8 @@ bool DateTimeLocalInputType::IsValidFormat(bool has_year, ...@@ -191,4 +191,8 @@ bool DateTimeLocalInputType::IsValidFormat(bool has_year,
return has_year && has_month && has_day && has_ampm && has_hour && has_minute; return has_year && has_month && has_day && has_ampm && has_hour && has_minute;
} }
String DateTimeLocalInputType::AriaRoleForPickerIndicator() const {
return GetLocale().QueryString(IDS_AX_CALENDAR_SHOW_DATE_TIME_LOCAL_PICKER);
}
} // namespace blink } // namespace blink
...@@ -67,6 +67,7 @@ class DateTimeLocalInputType final : public BaseTemporalInputType { ...@@ -67,6 +67,7 @@ class DateTimeLocalInputType final : public BaseTemporalInputType {
bool has_hour, bool has_hour,
bool has_minute, bool has_minute,
bool has_second) const override; bool has_second) const override;
String AriaRoleForPickerIndicator() const override;
}; };
} // namespace blink } // namespace blink
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/core/html/forms/month_input_type.h" #include "third_party/blink/renderer/core/html/forms/month_input_type.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/date_time_fields_state.h" #include "third_party/blink/renderer/core/html/forms/date_time_fields_state.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h" #include "third_party/blink/renderer/core/html/forms/html_input_element.h"
...@@ -168,4 +169,8 @@ bool MonthInputType::IsValidFormat(bool has_year, ...@@ -168,4 +169,8 @@ bool MonthInputType::IsValidFormat(bool has_year,
return has_year && has_month; return has_year && has_month;
} }
String MonthInputType::AriaRoleForPickerIndicator() const {
return GetLocale().QueryString(IDS_AX_CALENDAR_SHOW_MONTH_PICKER);
}
} // namespace blink } // namespace blink
...@@ -66,6 +66,7 @@ class MonthInputType final : public BaseTemporalInputType { ...@@ -66,6 +66,7 @@ class MonthInputType final : public BaseTemporalInputType {
bool has_hour, bool has_hour,
bool has_minute, bool has_minute,
bool has_second) const override; bool has_second) const override;
String AriaRoleForPickerIndicator() const override;
}; };
} // namespace blink } // namespace blink
......
...@@ -338,6 +338,10 @@ void MultipleFieldsTemporalInputTypeView::DidEndChooser() { ...@@ -338,6 +338,10 @@ void MultipleFieldsTemporalInputTypeView::DidEndChooser() {
GetElement().EnqueueChangeEvent(); GetElement().EnqueueChangeEvent();
} }
String MultipleFieldsTemporalInputTypeView::AriaRoleForPickerIndicator() const {
return input_type_->AriaRoleForPickerIndicator();
}
MultipleFieldsTemporalInputTypeView::MultipleFieldsTemporalInputTypeView( MultipleFieldsTemporalInputTypeView::MultipleFieldsTemporalInputTypeView(
HTMLInputElement& element, HTMLInputElement& element,
BaseTemporalInputType& input_type) BaseTemporalInputType& input_type)
......
...@@ -87,6 +87,7 @@ class MultipleFieldsTemporalInputTypeView final ...@@ -87,6 +87,7 @@ class MultipleFieldsTemporalInputTypeView final
Element& PickerOwnerElement() const final; Element& PickerOwnerElement() const final;
bool SetupDateTimeChooserParameters(DateTimeChooserParameters&) final; bool SetupDateTimeChooserParameters(DateTimeChooserParameters&) final;
void DidEndChooser() final; void DidEndChooser() final;
String AriaRoleForPickerIndicator() const final;
// ClearButtonElement::ClearButtonOwner functions. // ClearButtonElement::ClearButtonOwner functions.
void FocusAndSelectClearButtonOwner() override; void FocusAndSelectClearButtonOwner() override;
......
...@@ -184,7 +184,8 @@ void PickerIndicatorElement::DidNotifySubtreeInsertionsToDocument() { ...@@ -184,7 +184,8 @@ void PickerIndicatorElement::DidNotifySubtreeInsertionsToDocument() {
setAttribute(html_names::kRoleAttr, "button"); setAttribute(html_names::kRoleAttr, "button");
setAttribute( setAttribute(
html_names::kAriaLabelAttr, html_names::kAriaLabelAttr,
AtomicString(GetLocale().QueryString(IDS_AX_CALENDAR_SHOW_DATE_PICKER))); AtomicString(
this->picker_indicator_owner_->AriaRoleForPickerIndicator()));
} }
void PickerIndicatorElement::Trace(Visitor* visitor) { void PickerIndicatorElement::Trace(Visitor* visitor) {
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
namespace blink { namespace blink {
class HTMLInputElement;
class PickerIndicatorElement final : public HTMLDivElement, class PickerIndicatorElement final : public HTMLDivElement,
public DateTimeChooserClient { public DateTimeChooserClient {
USING_GARBAGE_COLLECTED_MIXIN(PickerIndicatorElement); USING_GARBAGE_COLLECTED_MIXIN(PickerIndicatorElement);
...@@ -56,6 +54,7 @@ class PickerIndicatorElement final : public HTMLDivElement, ...@@ -56,6 +54,7 @@ class PickerIndicatorElement final : public HTMLDivElement,
virtual Element& PickerOwnerElement() const = 0; virtual Element& PickerOwnerElement() const = 0;
virtual bool SetupDateTimeChooserParameters(DateTimeChooserParameters&) = 0; virtual bool SetupDateTimeChooserParameters(DateTimeChooserParameters&) = 0;
virtual void DidEndChooser() = 0; virtual void DidEndChooser() = 0;
virtual String AriaRoleForPickerIndicator() const = 0;
}; };
PickerIndicatorElement(Document&, PickerIndicatorOwner&); PickerIndicatorElement(Document&, PickerIndicatorOwner&);
...@@ -83,8 +82,6 @@ class PickerIndicatorElement final : public HTMLDivElement, ...@@ -83,8 +82,6 @@ class PickerIndicatorElement final : public HTMLDivElement,
InsertionNotificationRequest InsertedInto(ContainerNode&) override; InsertionNotificationRequest InsertedInto(ContainerNode&) override;
void DidNotifySubtreeInsertionsToDocument() override; void DidNotifySubtreeInsertionsToDocument() override;
HTMLInputElement* HostInput();
Member<PickerIndicatorOwner> picker_indicator_owner_; Member<PickerIndicatorOwner> picker_indicator_owner_;
Member<DateTimeChooser> chooser_; Member<DateTimeChooser> chooser_;
}; };
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/core/html/forms/time_input_type.h" #include "third_party/blink/renderer/core/html/forms/time_input_type.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/date_time_fields_state.h" #include "third_party/blink/renderer/core/html/forms/date_time_fields_state.h"
...@@ -173,4 +174,8 @@ bool TimeInputType::IsValidFormat(bool has_year, ...@@ -173,4 +174,8 @@ bool TimeInputType::IsValidFormat(bool has_year,
return has_hour && has_minute && has_ampm; return has_hour && has_minute && has_ampm;
} }
String TimeInputType::AriaRoleForPickerIndicator() const {
return GetLocale().QueryString(IDS_AX_CALENDAR_SHOW_TIME_PICKER);
}
} // namespace blink } // namespace blink
...@@ -62,6 +62,7 @@ class TimeInputType final : public BaseTemporalInputType { ...@@ -62,6 +62,7 @@ class TimeInputType final : public BaseTemporalInputType {
bool has_hour, bool has_hour,
bool has_minute, bool has_minute,
bool has_second) const override; bool has_second) const override;
String AriaRoleForPickerIndicator() const override;
}; };
} // namespace blink } // namespace blink
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/core/html/forms/week_input_type.h" #include "third_party/blink/renderer/core/html/forms/week_input_type.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/date_time_fields_state.h" #include "third_party/blink/renderer/core/html/forms/date_time_fields_state.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h" #include "third_party/blink/renderer/core/html/forms/html_input_element.h"
...@@ -125,4 +126,8 @@ bool WeekInputType::IsValidFormat(bool has_year, ...@@ -125,4 +126,8 @@ bool WeekInputType::IsValidFormat(bool has_year,
return has_year && has_week; return has_year && has_week;
} }
String WeekInputType::AriaRoleForPickerIndicator() const {
return GetLocale().QueryString(IDS_AX_CALENDAR_SHOW_WEEK_PICKER);
}
} // namespace blink } // namespace blink
...@@ -61,6 +61,7 @@ class WeekInputType final : public BaseTemporalInputType { ...@@ -61,6 +61,7 @@ class WeekInputType final : public BaseTemporalInputType {
bool has_hour, bool has_hour,
bool has_minute, bool has_minute,
bool has_second) const override; bool has_second) const override;
String AriaRoleForPickerIndicator() const override;
}; };
} // namespace blink } // namespace blink
......
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