Skip to content

fix(date-input): announce errors with the shared error prefix - #314

Merged
TaigaTi merged 3 commits into
mainfrom
fix/308-date-input-error-prefix
Oct 30, 2026
Merged

TaigaTi merged 3 commits into
mainfrom
fix/308-date-input-error-prefix

Conversation

@TaigaTi

@TaigaTi TaigaTi commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #308

DateInput rendered its error in its own govbb-error-message span, so the error text didn't include the visually hidden Error: prefix that the shared ErrorMessage adds. Screen readers heard the message without being told it was an error. Every other field (Input, TextArea, Select, Checkbox, Radio) already uses ErrorMessage. DateInput now does too. The error id, role="alert", the fieldset's aria-describedby and aria-invalid on day, month and year stay the same.

Verification

  • The existing error test now asserts that the error's text is exactly Error: Enter a valid date, so the prefix appears once, and that the fieldset still points to the error. Against the old component it fails with Received: "Enter a valid date".
  • The two error tests now find the error by its alert role, because searching for the bare message text no longer matches once the prefix is nested inside.
  • The axe test now also runs on the error state.
  • pnpm -r test (frontend 53/53, react 225/225), the react typecheck, pnpm lint and Prettier all pass.
  • Checked by hand with VoiceOver in Safari on macOS: the error is announced as "Error: Enter a valid date", with the prefix once.

Out of scope

The plain HTML error examples on the docs site have the same gap. That's tracked separately in #313.

🤖 Generated with Claude Code

Render the error through ErrorMessage so screen readers hear the visually
hidden "Error:" prefix, as they do for every other field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amazon-inspector-n-virginia

Copy link
Copy Markdown

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

@amazon-inspector-n-virginia

Copy link
Copy Markdown

✅ I finished the code review, and didn't find any security or code quality issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Design system preview

Preview torn down (PR closed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TaigaTi
TaigaTi requested a review from phrogwrld October 30, 2026 17:26

@phrogwrld phrogwrld left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed commit 69a5256. No actionable findings.

The switch to the shared ErrorMessage preserves the outer span, CSS class, error ID and role="alert". The fieldset's aria-describedby and all three inputs' invalid states remain unchanged. The regression tests check the exact prefixed text and error association; the shared component's tests cover the visually hidden prefix, and the new axe test covers the error state.

Independently verified against the PR snapshot:

  • React tests: 226/226 passed
  • Frontend tests: 53/53 passed
  • React typecheck, lint and formatting checks: passed

Not checked: Actual screen-reader announcements. The manual acceptance check from #308 remains outstanding; automated checks cannot confirm it.

Approved from code review.

@TaigaTi
TaigaTi merged commit adc94ce into main Oct 30, 2026
9 checks passed
@TaigaTi
TaigaTi deleted the fix/308-date-input-error-prefix branch October 30, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DateInput: error messages omit the accessible Error prefix

2 participants