feat(DateTimePicker): Add WCAG 2.1 AA accessibility improvements for DatePicker and TimePicker components #1078
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.
SUMMARY:
This PR implements WCAG 2.1 AA accessibility improvements for DatePicker and TimePicker components, adding proper ARIA roles, attributes, keyboard navigation, and focus management.
DatePicker Component
1. Calendar Grid Structure ARIA Roles
role="grid"to calendar<table>elementrole="row"to each<tr>elementrole="columnheader"withscope="col"to<th>elementsrole="gridcell"to each<td>elementFiles:
PartialBody.tsx,DateBody.tsx2. Date Cell ARIA Attributes
aria-selected="true/false"to date cells based on selection statearia-disabled="true"whendisabledDatereturns truearia-labelis present on all date cellsFiles:
PartialBody.tsx,Partial.types.ts,useCellProps.ts3. Keyboard Navigation
Shift + PageUp/PageDownfor year navigationFiles:
uiUtil.ts,Date.tsx4. Focus Management
Files:
DateBody.tsx,useCellProps.ts,OcPicker.tsx5. Visible Focus Indicators
:focus-visiblestyles with properborder-radiusmatchingFiles:
ocpicker.module.scssTimePicker Component
1. Time Selection ARIA Roles
role="listbox"on container (already implemented)role="option"on time options (already implemented)role="combobox"on trigger (already implemented)2. Time Column Labels
aria-labelto hours, minutes, seconds, and AM/PM columnsFiles:
TimeUnitColumn.tsx,TimeBody.tsx,Time.types.ts,OcPicker.types.ts, all locale filesGITHUB ISSUE (Open Source Contributors):
JIRA TASK (Eightfold Employees Only):
https://eightfoldai.atlassian.net/browse/ENG-167824
https://eightfoldai.atlassian.net/browse/ENG-167616
https://eightfoldai.atlassian.net/browse/ENG-167641
CHANGE TYPE:
TEST COVERAGE:
TEST PLAN:
Manual Testing
DatePicker Component:
role="grid"on<table>elementrole="row"on all<tr>elementsrole="columnheader"withscope="col"on<th>elementsrole="gridcell"on all<td>elementsaria-selected="true"aria-selected="false"aria-disabled="true"aria-labelPageUp/PageDownchanges monthShift + PageUp/PageDownchanges yearCtrl + Left/Rightchanges yearEnter/Spaceselects dateEsccloses pickerborder-radiusaria-selected="true"TimePicker Component:
role="listbox"on containerrole="option"on all time optionsrole="combobox"on trigger inputAccessibility Testing
Screen Reader Testing: