Skip to content

Commit 960bb4c

Browse files
kendrickumstattddsn5ft
authored andcommitted
[a11y][TimePicker] Include "hour" and "minute" in announcements. For example: "Not checked, Hour - 11'0 clock. double tap to select Hour".
PiperOrigin-RevId: 742718549
1 parent 3a5861c commit 960bb4c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/java/com/google/android/material/timepicker/TimePickerTextInputPresenter.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ public void onInitializeAccessibilityNodeInfo(
138138
View host, AccessibilityNodeInfoCompat info) {
139139
super.onInitializeAccessibilityNodeInfo(host, info);
140140
info.setContentDescription(
141-
host.getResources()
142-
.getString(
143-
time.getHourContentDescriptionResId(),
144-
String.valueOf(time.getHourForDisplay())));
141+
res.getString(R.string.material_timepicker_hour)
142+
+ " " // Adds a pause between the hour label and the hour value.
143+
+ host.getResources()
144+
.getString(
145+
time.getHourContentDescriptionResId(),
146+
String.valueOf(time.getHourForDisplay())));
145147
}
146148
});
147149
minuteTextInput.setChipDelegate(
@@ -151,8 +153,10 @@ public void onInitializeAccessibilityNodeInfo(
151153
View host, AccessibilityNodeInfoCompat info) {
152154
super.onInitializeAccessibilityNodeInfo(host, info);
153155
info.setContentDescription(
154-
host.getResources()
155-
.getString(R.string.material_minute_suffix, String.valueOf(time.minute)));
156+
res.getString(R.string.material_timepicker_minute)
157+
+ " " // Adds a pause between the minute label and the minute value.
158+
+ host.getResources()
159+
.getString(R.string.material_minute_suffix, String.valueOf(time.minute)));
156160
}
157161
});
158162

0 commit comments

Comments
 (0)