Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] DateInput aria-selected #816

Merged
merged 5 commits into from
Apr 5, 2024
Merged

Conversation

LJKaski
Copy link
Collaborator

@LJKaski LJKaski commented Dec 18, 2023

Description

This PR adds selected value or corresponding translation in the aria-label of the button representing the selected date in DatePicker. It also addresses an issue where a redundant aria-disabled=false attribute would be present in DOM for most day selectors in date picker.

Motivation and Context

This issue came up in discussions and is an accessibility oversight that needed to be fixed.

How Has This Been Tested?

Tested in styleguidist on chrome with NVDA and TalkBack and by checking the DOM.

Release notes

DateInput

  • Add selected date or corresponding translation for the selected date button in date picker
  • Remove redundant aria-attributes from DOM

@LJKaski LJKaski added the bug Something isn't working label Dec 18, 2023
@LJKaski LJKaski self-assigned this Dec 18, 2023
@LJKaski LJKaski requested a review from riitasointi as a code owner December 18, 2023 11:56
@LJKaski LJKaski force-pushed the fix/date-input-aria-selected branch 2 times, most recently from 9e6d16b to c5776c4 Compare December 19, 2023 08:38
@danielck
Copy link
Contributor

Unfortunately role="option" can only be used inside a listbox or group. After reviewing a few other implementations and options, semantically it seems the best bet is to do the following:

  • Set the tableto role="grid". This will allow us to use aria-selected later. A grid must have an accessible name, so it needs an aria-label. This can be simply the month + year.
  • Set role="gridcell" on individual tdelements, however this might not strictly be necessary according to the spec.
  • Set aria-selected="true" on the wrapping td, not the button.
  • Because there seems to be crappy support for everything mentioned above, I suggest adding "selected" to the aria label of the selected date.

@LJKaski LJKaski force-pushed the fix/date-input-aria-selected branch from c5776c4 to bc6404b Compare April 4, 2024 11:40
@LJKaski LJKaski merged commit 5390337 into develop Apr 5, 2024
1 check passed
@LJKaski LJKaski mentioned this pull request Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants