Visitar URL original
fix(date-picker)!: improve touch readout and weekday header announcements by jonathanbobel · Pull Request #6758 · uswds/uswds · GitHub
Skip to content

fix(date-picker)!: improve touch readout and weekday header announcements - #6758

Open
jonathanbobel wants to merge 13 commits into
developfrom
bug/5503-improve-touch-gestures-in-date-picker
Open

jonathanbobel wants to merge 13 commits into
developfrom
bug/5503-improve-touch-gestures-in-date-picker

Conversation

@jonathanbobel

@jonathanbobel jonathanbobel commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

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

⚠️ This is a 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-label values now lead with the full weekday: Tuesday, July 14, 2026 instead of 14 July 2026 Tuesday. Names still follow the document language.

.usa-date-picker__calendar__day-of-week no longer has an aria-label for 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. textContent on the th still 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 replaced 14 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 with aria-hidden="true". The header has no usa-sr-only text, no abbr, and no aria-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:

  • iOS VoiceOver - reaching header controls: Swipe left/right mainly walks the date grid from the focused date, so Previous/Next month and month/year can feel hard to reach by linear swipe alone. Explore by touch (place a finger on the screen and drag) is standard iOS VoiceOver and works to find those controls. Open status hints also point users at month/year controls. Not a regression from develop.
  • iOS VoiceOver - swipe up/down: Vertical swipes follow the VoiceOver rotor (e.g. Headings), not the calendar's week navigation. Users may hear "Heading not found" when the rotor is set to Headings. There is no reliable way to map up/down gestures to "move one week" while keeping normal VO gesture behavior. Left/right swipe for dates and header month controls remain the supported paths.
  • Numeric keypad on text input: Not changed; APG uses plain type="text" with aria-describedby for format hint. inputmode="numeric" was considered and deferred (not APG-aligned; conflicts with mm/dd/yyyy slash entry).
  • Desktop NVDA sparse announcements on open/arrow navigation: observed on APG as well; separate follow-up if needed.
  • APG dialog + grid pattern: Possible future improvement for landmark/rotor behavior; out of scope here.

Major changes

  • index.js
    • CALENDAR_OPEN_KEYBOARD_HINTS, CALENDAR_OPEN_TOUCH_HINTS
    • isTouchPrimaryDevice(), getCalendarOpenStatusHints()
    • renderCalendar: touch vs keyboard hints on first open
    • Date buttons: aria-label leads with the localized full weekday
    • Weekday headers: aria-hidden visible abbreviation only
  • date-picker.spec.js
    • Keyboard vs touch status hints on calendar open
    • Visual-only day-of-week headers, and weekday-first date button labels
  • date-picker-i18n.spec.js
    • Localized visible abbreviations, and localized weekday-first date button labels

Testing and review

  • iOS Safari + VoiceOver: Open calendar: status mentions swipe, double-tap, and month controls (not arrow keys)
  • iOS Safari + VoiceOver: Swipe left/right through dates: hear the button label, such as "Thursday, July 14, 2026", without a "Th -" or "T, T" prefix
  • iOS Safari + VoiceOver: After open, explore by touch (drag) can reach Previous/Next month and month/year buttons
  • iOS Safari + VoiceOver: Swipe up/down may say "Heading not found" depending on rotor: expected; not week navigation
  • Desktop / keyboard-first: Open calendar: status mentions arrow keys (not swipe)
  • Desktop keyboard: Arrow keys still move focused date; Tab still reaches header controls
  • Spanish (lang="es") on document: Weekday headers show localized visible abbreviations (D, L, M, X, J, V, S). Date button labels lead with the localized full weekday. Headers have no usa-sr-only name.
  • Select a date: value updates; calendar closes
  • Compare header/date readout to develop on iOS: should be improved or equivalent, not regressed

Unit tests pass:

  • packages/usa-date-picker/src/test/date-picker.spec.js
  • packages/usa-date-picker/src/test/date-picker-i18n.spec.js

References

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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ All commits on this PR have a verified signature. Thanks!

@chandracarney chandracarney moved this from Triage to In progress in USWDS Core Project Data Jul 20, 2026
@chandracarney chandracarney added Affects: Accessibility 🟡 Affects access for disabled users or assistive tech. Record the barrier; not a severity score. Context: VoiceOver (VO) Issue is in the VoiceOver screen reader labels Jul 28, 2026
@jonathanbobel jonathanbobel self-assigned this Jul 28, 2026
@jonathanbobel jonathanbobel added the A11y Audit Accessibility audit work or its findings. Preserve the test scope and evidence in the issue. label Jul 29, 2026
@jonathanbobel
jonathanbobel marked this pull request as ready for review August 4, 2026 15:58
@jonathanbobel
jonathanbobel marked this pull request as draft August 4, 2026 15:58
jonathanbobel and others added 3 commits September 9, 2026 11:39
…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
@jonathanbobel
jonathanbobel marked this pull request as ready for review September 10, 2026 14:02
chandracarney
chandracarney previously approved these changes Sep 10, 2026

@chandracarney chandracarney left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing this on VoiceOver and walking through it so thoroughly! Passing to @ethangardner for code review.

@ryparker

Copy link
Copy Markdown
Member

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: QUIET

Plan: Advanced

Run ID: 316393f4-24a5-4331-86a1-25acf92c9f40


📥 Commits

Reviewing files that changed from the base of the PR and between 9cdc99a and 1f2e3ce.


📒 Files selected for processing (3)
  • packages/usa-date-picker/src/index.js
  • packages/usa-date-picker/src/test/date-picker-i18n.spec.js
  • packages/usa-date-picker/src/test/date-picker.spec.js

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.



📝 Summary

Summary by CodeRabbit

  • Accessibility
    • Added device-appropriate instructions for opening the calendar on touch and keyboard devices.
    • Updated date button labels to announce the localized weekday, month, day, and year.
    • Improved calendar weekday headers for clearer visual display and assistive technology support.
  • Tests
    • Added coverage for device-specific opening instructions and accessible date labels.
    • Updated internationalization tests for the revised weekday and date announcements.

Walkthrough

The date picker now uses device-specific calendar opening hints. It renders abbreviated weekday headers as visual text and includes localized weekday names in date button labels. Tests cover touch, keyboard, English, and Spanish behavior.

Changes

Date picker accessibility

Layer / File(s) Summary
Device-specific opening hints
packages/usa-date-picker/src/index.js, packages/usa-date-picker/src/test/date-picker.spec.js
The calendar selects keyboard or touch navigation hints from iOS detection and coarse-pointer media queries. Tests verify both paths and restore window.matchMedia.
Calendar labels and weekday headers
packages/usa-date-picker/src/index.js, packages/usa-date-picker/src/test/date-picker.spec.js, packages/usa-date-picker/src/test/date-picker-i18n.spec.js
Weekday headers render abbreviated text in aria-hidden spans. Date button labels use weekday-first localized text. Tests cover English and Spanish labels and header markup.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: Is: Breaking 🔴, Context: JavaScript


Merge Risk: ⚪ Minimal · up to 1f2e3

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 | Passed 9 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Accessibility Verification Declared Warning The check applies because the diff changes aria-label, aria-hidden, weekday screen-reader markup, and the live status instructions. The description names iOS Safari + VoiceOver, but the manual acc… Add a completed accessibility test matrix to the PR description. For each scenario, list the physical device, browser, browser version, and assistive technology and state what was verified: (1) iOS Safari + VoiceOver for calendar opening, d…
✅ Passed checks (9 passed)
Check name Status Explanation
Linked Issues check Passed Issue #5503 requires touch guidance instead of keyboard guidance and clearer date announcements. packages/usa-date-picker/src/index.js selects touch instructions for iOS or coarse-pointer devices. D…
Out of Scope Changes check Passed The reviewed changes are limited to date picker behavior and its related accessibility and localization tests. The source changes and tests directly support the touch guidance and weekday announcement…
Breaking Change Declared Passed The description contains exactly one template statement: "This is not a breaking change." The authoritative diff changes only three JavaScript test/source files. It keeps the same `module.exports = da…
No New Runtime Dependency Passed The PR does not change package.json dependencies: base and head both contain only "lit": "3.3.3". The only changed production JavaScript file is packages/usa-date-picker/src/index.js, and its diff add…
Regression Test Targets The Change Passed PASS. The PR changes production JavaScript in packages/usa-date-picker/src/index.js and adds or updates Mocha *.spec.js tests. The new date-picker tests exercise the coarse-pointer touch branch an…
New Api Surface Follow-Ups Passed PASS — The authoritative PR range changes only three JavaScript test/source files. It does not add a $theme-* setting, Sass mixin or function, forwarded Sass API, data-* attribute constant, or a new…
Theme Token Discipline Passed PASS: The pull request changes only three JavaScript files under packages/usa-date-picker. The authoritative review-range diff contains no .scss files, so it introduces no SCSS literal or token-functi…
Title check Passed The title follows the required Conventional Commit syntax and accurately describes the touch readout and weekday header changes.
Description check Passed The description clearly explains the touch instructions, date labels, weekday headers, tests, and out-of-scope limitations covered by the changeset.

Full details: Accessibility Verification Declared

Explanation

The check applies because the diff changes aria-label, aria-hidden, weekday screen-reader markup, and the live status instructions. The description names iOS Safari + VoiceOver, but the manual accessibility checklist items are unchecked. It does not name browser and assistive-technology combinations for the desktop keyboard scenario, the coarse-pointer touch path, or the Spanish localization scenario. The repository PR template requires physical-device and relevant-assistive-technology coverage, with those devices and technologies listed. This assessment does not judge announcement behavior.

Resolution

Add a completed accessibility test matrix to the PR description. For each scenario, list the physical device, browser, browser version, and assistive technology and state what was verified: (1) iOS Safari + VoiceOver for calendar opening, date navigation, and header-control access; (2) a non-iOS coarse-pointer device, browser, and screen reader for touch opening instructions; (3) a desktop browser and assistive-technology combination for keyboard opening, arrow navigation, and tab access; and (4) the browser and assistive technology used for Spanish weekday and date-label coverage. Mark the manual accessibility checklist complete only after these tests are performed.



Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ethangardner ethangardner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 marked aria-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.

@jonathanbobel

Copy link
Copy Markdown
Contributor Author

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 marked aria-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

@jonathanbobel jonathanbobel changed the title USWDS - Date picker: Improve touch readout and weekday header announcements fix(date-picker): improve touch readout and weekday header announcements Sep 23, 2026

@ethangardner ethangardner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying and updating the PR body. This work looks good!

@ryparker ryparker added the Is: Breaking 🔴 Suggestion would be a breaking change label Sep 25, 2026
@ryparker

Copy link
Copy Markdown
Member

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 14 July 2026 Tuesday to Tuesday, July 14, 2026. The weekday headers also lose their full-day aria-label and place their visible abbreviation inside an aria-hidden span. Exact-name queries and custom code reading those header labels therefore need to change.

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.

@jonathanbobel jonathanbobel changed the title fix(date-picker): improve touch readout and weekday header announcements fix(date-picker)!: improve touch readout and weekday header announcements Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A11y Audit Accessibility audit work or its findings. Preserve the test scope and evidence in the issue. Affects: Accessibility 🟡 Affects access for disabled users or assistive tech. Record the barrier; not a severity score. Context: VoiceOver (VO) Issue is in the VoiceOver screen reader Is: Breaking 🔴 Suggestion would be a breaking change

Projects

No open projects
Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants