Visitar URL original
USWDS - Date Picker: Add aria-current to today's date button by daresTheDevil · Pull Request #6593 · uswds/uswds · GitHub
Skip to content

USWDS - Date Picker: Add aria-current to today's date button - #6593

Merged
ethangardner merged 6 commits into
uswds:developfrom
daresTheDevil:fix/date-picker-aria-current-6546
Jun 3, 2026
Merged

ethangardner merged 6 commits into
uswds:developfrom
daresTheDevil:fix/date-picker-aria-current-6546

Conversation

@daresTheDevil

Copy link
Copy Markdown
Contributor

Summary

Improved screen reader identification of the current date. Today's date button in the calendar widget now includes aria-current="date" so assistive technologies can programmatically identify it.

Breaking change

This is not a breaking change.

Related issue

Closes #6546

Related pull requests

None.

Problem statement

The date picker calendar visually highlights today's date with the usa-date-picker__calendar__date--today CSS class, but there's no programmatic indicator for screen readers. Users relying on assistive technologies can't tell which date is today when navigating the calendar. This is a gap in WCAG 1.3.1 (Info and Relationships).

Solution

Added aria-current="date" to the today button during calendar rendering. The attribute is only set on the single button matching today's date. No other dates are affected.

Major changes

  • Extract isToday boolean from existing isSameDay(dateToRender, todaysDate) check
  • Set aria-current="date" on the button element when isToday is true

Testing and review

  • All 273 date picker tests pass (4 new)
  • New test confirms today's button has aria-current="date"
  • New test confirms non-today buttons do not have aria-current
  • Run npm test to verify

Screen readers had no programmatic way to identify the current date in
the calendar widget. The today class only provides a visual indicator.
Adding aria-current='date' to the today button satisfies WCAG 1.3.1
(Info and Relationships) by exposing the current date semantically.

Closes uswds#6546
@annepetersen annepetersen added Affects: Accessibility 🟡 Affects access for disabled users or assistive tech. Record the barrier; not a severity score. Needs: Confirmation Reported behavior needs validation. Remove after recording reproduction or investigation results. Help wanted Community contributions are welcome; scope and acceptance criteria should be clear before applying. labels Mar 27, 2026
@annepetersen annepetersen added Affects: Markup 🟡 Suggestion would change the markup of a component Package: Date Picker Work affecting Date Picker. Apply only when this area helps route or find the issue. labels Mar 27, 2026

@jerseycheese jerseycheese left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verified the bug independently on the live design system docs (https://designsystem.digital.gov/components/date-picker/): today's button carries the --today class but no aria-current anywhere in the rendered calendar. The patch closes that gap exactly. LGTM.

Good Calls

  • Reusing the existing isSameDay(dateToRender, todaysDate) check by extracting isToday keeps the change to a few lines and avoids a second date comparison.
  • aria-current="date" is the right token value per ARIA 1.2 (vs. "true" or omitting the value).
  • Tests cover both directions (positive on today, negative on the rest), which is the right shape for an attribute that should appear exactly once.

@annepetersen annepetersen removed the Help wanted Community contributions are welcome; scope and acceptance criteria should be clear before applying. label May 27, 2026
@annepetersen annepetersen added Status: Accepted Legacy workflow marker. and removed Needs: Confirmation Reported behavior needs validation. Remove after recording reproduction or investigation results. labels Jun 1, 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.

LGTM - thanks for the contribution!

@ethangardner
ethangardner merged commit c38cb7e into uswds:develop Jun 3, 2026
3 checks passed
@ethangardner ethangardner added this to the uswds 3.14.0 - Aug 2026 milestone Aug 4, 2026
@annepetersen annepetersen added the ❤️ Thanks Historical appreciation marker. Prefer a reaction; not required for triage. label Aug 5, 2026
@github-project-automation github-project-automation Bot moved this from Triage to Fed Final Review in USWDS Core Project Data Aug 21, 2026
@chandracarney chandracarney moved this from Fed Final Review to Done in USWDS Core Project Data Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects: Accessibility 🟡 Affects access for disabled users or assistive tech. Record the barrier; not a severity score. Affects: Markup 🟡 Suggestion would change the markup of a component Package: Date Picker Work affecting Date Picker. Apply only when this area helps route or find the issue. Status: Accepted Legacy workflow marker. ❤️ Thanks Historical appreciation marker. Prefer a reaction; not required for triage.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

USWDS - Bug: Date Picker Widget does not use Aria-Current to indicate current date

5 participants