Repository navigation
fix(date-picker)!: improve touch readout and weekday header announcements - #6758
jonathanbobel wants to merge 13 commits into
Conversation
|
✅ All commits on this PR have a verified signature. Thanks! |
…e-touch-gestures-in-date-picker
…e-touch-gestures-in-date-picker Co-authored-by: Cursor <cursoragent@cursor.com>
…in-date-picker' into bug/5503-improve-touch-gestures-in-date-picker
chandracarney
left a comment
There was a problem hiding this comment.
Thanks for testing this on VoiceOver and walking through it so thoroughly! Passing to @ethangardner for code review.
…e-touch-gestures-in-date-picker
…ub.com:uswds/uswds into bug/5503-improve-touch-gestures-in-date-picker
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to The accessibility updates and their focused tests do not show an actionable regression. The change is ready to merge with normal checks. Pre-merge checks |
|
ethangardner
left a comment
There was a problem hiding this comment.
I really appreciate the depth here, and great job with the tests! I have a question regarding the PR body. I see the following:
Weekday elements keep compact visible abbreviations (T, W, etc.) for layout, but expose the full day name to assistive tech via
usa-sr-only, with the visible abbreviation markedaria-hidden="true".
I see the aria and the visible abbreviations, but I'm not seeing the usa-sr-only, and there's a test that indicates that the sr-only should not be there.
I just wanted to check to see if that's something that should be addressed or if it was something I missed.
@ethangardner thanks for your review. I updated the PR comments to reflect the current work, it had diverged a bit over a few rounds of revisions and related work in #5505 |
ethangardner
left a comment
There was a problem hiding this comment.
Thanks for clarifying and updating the PR body. This work looks good!
|
This improves the calendar's announcements, and it also changes the generated content that consuming sites may reference. Date button labels change from forms such as I added the breaking label for the generated markup and content changes. That classification does not reverse the accessibility testing already recorded here. The upgrade notes should identify the new date-label format and header structure so teams can update dependent selectors and tests. |
USWDS - Date picker: Improve touch readout and weekday header announcements
Summary
Improves the date picker calendar for touch and iOS VoiceOver users by announcing touch-specific instructions when the calendar opens on touch-primary devices, and by fixing weekday header and date readout so VoiceOver no longer prefixes dates with ambiguous abbreviations (e.g. "Th - sept 28" or "T, T, July 14th"). Date buttons announce the full weekday (for example "Thursday, July 14, 2026"). Weekday headers stay visual only.
Breaking change
Date picker calendars generate different accessible names and header markup. Update tests and custom code that read those strings or that DOM.
Date button
aria-labelvalues now lead with the full weekday:Tuesday, July 14, 2026instead of14 July 2026 Tuesday. Names still follow the document language..usa-date-picker__calendar__day-of-weekno longer has anaria-labelfor the full day name. The visible abbreviation is inside<span aria-hidden="true">. The header accessible name is empty. Read the abbreviation from that span.textContenton thethstill includes it.Related issue
Related to #5503
Problem statement
Desired: On touch devices with VoiceOver, opening the calendar should announce guidance that matches swipe/double-tap interaction. When navigating dates, users should hear the full weekday from the date button, without confusing letter prefixes from the column headers.
Actual (before): The status region always announced keyboard instructions (arrow keys, Page Up/Down) on open, even on iOS/touch. When swiping through dates, VoiceOver could read abbreviated weekday letters before the date (e.g. "T - sept 28"), or duplicate narrow letters ("T, T, July 14th") depending on header markup - behavior that differed from develop and was hard to interpret.
Consequences: Touch users received irrelevant keyboard guidance on open. iOS VoiceOver users got garbled or redundant weekday context while moving through the date grid, making the calendar harder to use with VoiceOver Gestures.
Solution
Three complementary changes in packages/usa-date-picker/src/index.js:
Touch-aware open instructions
On first calendar open, the polite status region announces touch hints on iOS and (pointer: coarse) devices (swipe, double-tap, month/year controls). Desktop/keyboard-first devices still receive the existing keyboard hints.
Weekday-first date button labels
Each date button aria-label leads with the full localized weekday, for example
Thursday, July 14, 2026. That replaced14 July 2026 Thursday.Visual-only weekday column headers
Weekday
<th>elements keep compact visible abbreviations (T, W, and so on) for layout. The abbreviation is wrapped in a span witharia-hidden="true". The header has nousa-sr-onlytext, noabbr, and noaria-label. The spoken weekday comes from the date button. This keeps iOS Safari + VoiceOver from reading the narrow letters in front of the date.Why this approach: Aligns open instructions with the user's input modality. Hiding the compact header letters from assistive tech stops the ambiguous or duplicate letter prefix, while the date button still announces the full weekday. No change to role="application", dialog semantics, or tab order.
Limitations / not in scope / still TBD:
develop.Major changes
index.jsdate-picker.spec.jsdate-picker-i18n.spec.jsTesting and review
Unit tests pass:
packages/usa-date-picker/src/test/date-picker.spec.jspackages/usa-date-picker/src/test/date-picker-i18n.spec.jsReferences
WAI-ARIA APG
WCAG 2.2
Maintainer scope clarification (ryparker, September 20, 2026): The closing reference has been changed to a related reference because this PR does not settle every reported touch-navigation and keypad concern. The remaining cases stay in #5503 for current-device testing and an explicit resolution; this change does not expand the implementation scope of this PR.