Improve/Fix Accessibility for WeekdayPicker Component for Screen reader #6055
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #6051
What this PR does
This PR fixes the accessibility of the Calendar and WeekdayPicker components by introducing the
aria-label
and removingaria-pressed
. And propariaModifier
which was not being used was replaced by a simple hardcoded string which is used to detect if a "weekday" is selected.Cause of the Bug:
The
ariaModifier
prop (of typePropTypes.string
) required by the WeekdayPicker component was not being passed from the Calendar component or any of its parent components. This prop is essential for determining whether a button has been pressed and updating thearia-pressed
attribute accordingly. As a result, thearia-pressed
attribute remainedfalse
even when the button was pressed because it depended on the correct value ofariaModifier.
Which was not passed in the first place itself.Screenshots
Before:
Before.mp4
After:
2024-12-11.15-43-50.mp4
Open questions and concerns
I applied CSS to hide the
aria-live
div (weekday_picker.jsx), using a style similar to that already used for hiding admin notes. Although the two elements use different class names, the CSS properties are the same. I considered using a single shared CSS class for both cases but was uncertain about the best file to place this shared CSS in.