Skip to content

Commit

Permalink
[DatePicker][a11y] Properly announce the change of selection between …
Browse files Browse the repository at this point in the history
…year/day

PiperOrigin-RevId: 675901350
  • Loading branch information
paulfthomas authored and dsn5ft committed Sep 19, 2024
1 parent c08ee83 commit c06ef1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,12 @@ void setSelector(CalendarSelector selector) {
void toggleVisibleSelector() {
if (calendarSelector == CalendarSelector.YEAR) {
setSelector(CalendarSelector.DAY);
recyclerView.announceForAccessibility(
getString(R.string.mtrl_picker_toggled_to_day_selection));
} else if (calendarSelector == CalendarSelector.DAY) {
setSelector(CalendarSelector.YEAR);
yearSelector.announceForAccessibility(
getString(R.string.mtrl_picker_toggled_to_year_selection));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<string name="mtrl_picker_a11y_next_month" description="a11y string to indicate this button moves the calendar to the next month [CHAR_LIMIT=NONE]">Change to next month</string>
<string name="mtrl_picker_toggle_to_year_selection" description="a11y string to indicate this button switches the user to choosing a year [CHAR_LIMIT=NONE]">Tap to switch to year view</string>
<string name="mtrl_picker_toggle_to_day_selection" description="a11y string to indicate this button switches the user to choosing a day [CHAR_LIMIT=NONE]">Tap to switch to Calendar view</string>
<string name="mtrl_picker_toggled_to_year_selection" description="a11y string to indicate this view switched the user to choosing a year [CHAR_LIMIT=NONE]">Switched to year view</string>
<string name="mtrl_picker_toggled_to_day_selection" description="a11y string to indicate this view switched the user to choosing a day [CHAR_LIMIT=NONE]">Switched to Calendar view</string>
<string name="mtrl_picker_day_of_week_column_header" description="a11y string to indicate this is a header for a column of days for one day of the week (e.g., Monday) [CHAR_LIMIT=NONE]">%1$s</string>
<string name="mtrl_picker_announce_current_selection" description="a11y string read on selection change to indicate the new selection [CHAR_LIMIT=NONE]">Current selection: %1$s</string>
<string name="mtrl_picker_announce_current_range_selection" description="a11y string read on range selection change to indicate the new selection [CHAR_LIMIT=NONE]">Start date selection: %1$s – End date selection: %2$s</string>
Expand Down

0 comments on commit c06ef1b

Please sign in to comment.