fix(ui-calendar): DateInput2 days missing aria-selected#2506
Conversation
|
4892b87 to
7619801
Compare
| @@ -33,14 +33,15 @@ type DateInputOwnProps = { | |||
| */ | |||
| renderLabel: Renderable | |||
| /** | |||
| * Accessible labels for the calendar button, month navigation buttons, and date picker dialog. | |||
| * Accessible labels for the calendar button, month navigation buttons, date picker dialog, and selected date state. | |||
| */ | |||
| screenReaderLabels: { | |||
| calendarIcon: string | |||
| prevMonthButton: string | |||
| nextMonthButton: string | |||
| // TODO: Make this field required in the next version. Currently optional to avoid breaking change. | |||
There was a problem hiding this comment.
It’s not included in v1 yet, so I left it unchanged. As I understand it, this will apply to v3.
This is also the case for DateInput2
There was a problem hiding this comment.
If its just used in v11.7, then please make it mandatory
| * Screen reader label appended to the date label when the day is selected. | ||
| * Used to announce the selected state to assistive technologies. | ||
| */ | ||
| selectedLabel?: string |
There was a problem hiding this comment.
I think this can be made mandatory in v2
| */ | ||
| screenReaderLabels: { | ||
| calendarIcon: string | ||
| prevMonthButton: string | ||
| nextMonthButton: string | ||
| // TODO: Make this field required in the next version. Currently optional to avoid breaking change. | ||
| datePickerDialog?: string | ||
| selectedLabel?: string |
There was a problem hiding this comment.
I think this can be mandatory in v2
| @@ -33,14 +33,15 @@ type DateInputOwnProps = { | |||
| */ | |||
| renderLabel: Renderable | |||
| /** | |||
| * Accessible labels for the calendar button, month navigation buttons, and date picker dialog. | |||
| * Accessible labels for the calendar button, month navigation buttons, date picker dialog, and selected date state. | |||
| */ | |||
| screenReaderLabels: { | |||
| calendarIcon: string | |||
| prevMonthButton: string | |||
| nextMonthButton: string | |||
| // TODO: Make this field required in the next version. Currently optional to avoid breaking change. | |||
There was a problem hiding this comment.
If its just used in v11.7, then please make it mandatory
| * Screen reader label appended to the date label when the day is selected. | ||
| * Used to announce the selected state to assistive technologies. | ||
| */ | ||
| selectedLabel?: string |
There was a problem hiding this comment.
I think this can be made mandatory
There was a problem hiding this comment.
If this becomes mandatory in DateTimeInput/v1, it will also impact Calendar/v1, Day/v1, and DateInput/v1.
Should I create a DateTimeInput/v2 and make it mandatory there?
There was a problem hiding this comment.
hmm if this would be the only change, then no IMO
There was a problem hiding this comment.
https://github.com/instructure/instructure-ui/pull/2518/changes#diff-654096f083ddf568261002852e75214784f20bb79fd09eb025f0905774fe99da should be mandatory in v2, but in this PR
1fbb850 to
072c29b
Compare
072c29b to
cd05e2f
Compare
cd05e2f to
8e7708b
Compare
0c00547 to
bf24b70
Compare
bf24b70 to
67a968a
Compare
…DateInput v1 with DateInput v2 in DateTimeInput BREAKING CHANGE: renderWeekdayLabels` prop removed `calendarIcon` is a new required prop INSTUI-4791
8e7708b to
60c5f40
Compare
…elected on calendar days, BREAKING CHANGE: add mandatory prop selectedLabel, change datePickerDialog prop to mandatory
60c5f40 to
3d35405
Compare
Visual regression report✅ No changes.
Baselines come from the |
…) 6582ff1cb1e1f384c66101d85e731a8d15bcad8e
INSTUI-4989
When a user selects a date, screen readers had no way to know which day was currently selected — aria-selected
Solution summary
Every ARIA role that supports aria-selected requires a specific ancestor context — there's no standalone option
The only axe-clean alternatives for table mode without structural changes:
Changes
aria-selectedon calendar days inDateInput,DateInput2, andDateTimeInputwhen using the default table layoutlistboxmode (role="listbox"), days correctly userole="option"witharia-selected="true/false"; in table mode, days userole="button"wherearia-selectedis not ARIA-valid, so selection is now announced via a newselectedLabelprop that appends text to the accessible label (e.g."15 April 2026, Selected")selectedLabelprop toCalendar,Calendar.Day,DateInput(v1/v2),DateInput2, andDateTimeInput— passed throughscreenReaderLabels.selectedLabelin the DateInput variants;Test plan
On the docs page, try this code sample and check what VoiceOver announces:
Co-Authored-By: 🤖 Claude