Improve accessibility for month and year dropdowns (select + custom modes)#6287
Open
balajis-qb wants to merge 2 commits into
Open
Improve accessibility for month and year dropdowns (select + custom modes)#6287balajis-qb wants to merge 2 commits into
balajis-qb wants to merge 2 commits into
Conversation
…sibility - Changed month option buttons from <div> to <li> elements to better reflect their role in a list. - Updated ARIA roles and attributes for better screen reader support, including setting role="option" and aria-haspopup="listbox". - Added aria-hidden to the down arrow and check mark for improved accessibility. - Enhanced test cases to verify ARIA attributes and accessibility features in the month dropdown. Closes Hacker0x01#6223
…lity - Updated year option buttons from <div> to <li> elements to better represent their role in a list. - Changed ARIA roles and attributes for better screen reader support, including setting role="option" and aria-haspopup="listbox". - Added aria-hidden to the down arrow and check mark for improved accessibility. - Introduced a new <ul> wrapper for year options to enhance semantic structure. - Enhanced test cases to verify ARIA attributes and accessibility features in the year dropdown. Closes Hacker0x01#6223
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6287 +/- ##
==========================================
- Coverage 99.29% 99.29% -0.01%
==========================================
Files 30 30
Lines 3822 3820 -2
Branches 1648 1646 -2
==========================================
- Hits 3795 3793 -2
Misses 26 26
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR improves the accessibility of the month and year dropdowns in the date picker, covering both native select mode and custom dropdown (scroll) mode.
The changes ensure that both implementations provide correct semantics and a better experience for screen reader users, while keeping the existing API surface minimal.
Background
This PR addresses the issue raised in:
Issue: #6223
Previous PR: #6232
This PR replaces the earlier one with an updated implementation that incorporates prior review feedback.
Description
Linked issue: 6223
Problem
The current implementation of month and year dropdowns has few accessibility gaps:
scrollmode) does not fully follow listbox semanticsrole="button"for selectable items) leads to inconsistent screen reader behaviorThese issues result in:
Changes
sr-only) text where needed (e.g., “Month”) for consistent announcementsInteraction behavior
Navigation controls remain buttons (actions), not options. They are:
This aligns with ARIA practices, where only
role="option"participates in arrow navigation.API Impact
ariaMonthDropdownLabel)If needed, support for custom
aria-labelscan be added in a future iteration.Testing
Tested with:
Contribution checklist