Visitar URL original
USWDS - Memorable Date: Adjusting date hint text and format by jonathanbobel · Pull Request #6725 · uswds/uswds · GitHub
Skip to content

USWDS - Memorable Date: Adjusting date hint text and format - #6725

Merged
ethangardner merged 7 commits into
developfrom
bug/5903-memorable-date-format-for-screen-readers
Aug 7, 2026
Merged

ethangardner merged 7 commits into
developfrom
bug/5903-memorable-date-format-for-screen-readers

Conversation

@jonathanbobel

@jonathanbobel jonathanbobel commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When users moved through the memorable date fields, every control shared one hint (mdHint), so screen readers repeated the full month/day/year instructions on each field. This change adds field-specific hints wired with aria-describedby, keeps a visible group hint for sighted users, and uses a consistent {field-id}-hint id pattern aligned with other USWDS form components.

Breaking change

This is not a breaking change.

Authors who copied the old shared mdHint markup should update to per-field hints. Default component markup is updated; no API or JS changes.

Related issue

Closes #5902

Problem statement

The memorable date component used a single group hint referenced by all three fields (month, day, year) via aria-describedby="mdHint". When a user focused each field, assistive technology announced the entire instruction block every time (dropdown + day format + year format), not guidance specific to that field.

The form test pattern (test-usa-form.twig) was also out of date: it still used the shared hint pattern and month options with leading numbers (01 - January), which USWDS removed in 3.9.0 because dual number/name labels confused screen reader users.

Solution

  • Per-field hints - Each control gets its own hint id ({id}-month-hint, {id}-day-hint, {id}-year-hint) and aria-describedby pointing only at that hint.
  • Group hint for sighted users - A visible overview hint remains under the legend with aria-hidden="true" so it does not duplicate announcements for assistive technology.
  • Screen-reader-only field hints - Per-field hints use usa-sr-only so AT gets targeted guidance on focus without cluttering the visual layout.
  • Configurable ids - Twig accepts an id variable (default memorable-date) to generate field and hint ids using the {field-id}-hint pattern used elsewhere in USWDS (file input, date picker).
  • Tests - Added unit tests for markup and associations in memorable-date.spec.js.
  • Storybook fixture - Updated test-usa-form.twig so Disabled/Error form stories match the component (per-field hints, month names without leading numbers, error id wired into aria-describedby when error_state is true).

Major changes

  • packages/usa-memorable-date/src/usa-memorable-date.twig - per-field hints, configurable ids, group hint with aria-hidden
  • packages/usa-memorable-date/src/test/memorable-date.spec.js - markup and aria-describedby tests
  • packages/usa-memorable-date/src/test/template.html - unit test fixture
  • packages/usa-form/src/test/test-pattern/test-usa-form.twig - Storybook form demo aligned with component

Testing and review

  • Focus month field - hear month-specific hint only (not full day/year instructions)
  • Focus day field - hear day format hint only
  • Focus year field - hear year format hint only
  • Sighted users still see group hint under legend
  • Group hint is not announced when tabbing fields (VoiceOver / NVDA)
  • Storybook: Patterns/Forms → DisabledFormElements and TestErrorFormElements render correctly
  • Error story: fields reference both field hint and error id in aria-describedby
  • Unit tests pass (packages/usa-memorable-date/src/test/memorable-date.spec.js)

References

WAI-ARIA APG

Accessible Names and Descriptions — hints associated with controls via aria-describedby
Form Patterns — labels name controls; descriptions supplement with format or instruction

WCAG 2.2

3.3.2 Labels or Instructions (Level A) - format instructions available when needed for each field
4.1.2 Name, Role, Value (Level A) - programmatic association between fields and their descriptions

@jonathanbobel jonathanbobel changed the title Adjusting memorable date hint text and format USWDS - Memorable Date: Adjusting date hint text and format Jun 22, 2026
@jonathanbobel jonathanbobel added the A11y Audit Accessibility audit work or its findings. Preserve the test scope and evidence in the issue. label Jun 22, 2026
@jonathanbobel jonathanbobel self-assigned this Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@jonathanbobel
jonathanbobel marked this pull request as ready for review June 25, 2026 18:25
@ethangardner ethangardner moved this from Triage to Ready to Schedule in USWDS Core Project Data Jun 30, 2026
@ethangardner ethangardner moved this from Ready to Schedule to In progress in USWDS Core Project Data Jul 17, 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.

This looks good. Thanks for being patient waiting on me to review it, and adding the tests. If you wanted to do a follow-up enhancement PR, you might want to consider adding importing the single usa-memorable-date.twig file into the test form so there's one source of truth and the props don't drift over time. That's not a blocker here though.

@chandracarney - you're up for a final a11y review.

@jonathanbobel jonathanbobel added the Affects: Accessibility 🟡 Affects access for disabled users or assistive tech. Record the barrier; not a severity score. label Aug 3, 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.

Looks good, thanks for discussing!

Comment thread packages/usa-form/src/test/test-pattern/test-usa-form.twig
Comment thread packages/usa-memorable-date/src/usa-memorable-date.twig
@ethangardner
ethangardner merged commit f813c7f into develop Aug 7, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Fed Final Review in USWDS Core Project Data Aug 7, 2026
@annepetersen annepetersen added this to the uswds 3.14.0 - Aug 2026 milestone Aug 7, 2026
@annepetersen annepetersen added the Package: Memorable date Work affecting Memorable date. Apply only when this area helps route or find the issue. label Aug 7, 2026
@annepetersen annepetersen moved this from Fed Final Review to Done in USWDS Core Project Data Aug 17, 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. Package: Memorable date Work affecting Memorable date. Apply only when this area helps route or find the issue.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

USWDS - Memorable date: Input formatting requirements are unclear to users of screen readers.

4 participants