Skip to content

Associate validation errors with form fields using aria-invalid and aria-describedby #30

Description

@mikewheeleer

Improve form accessibility by linking errors to fields

Description

The quote, new-pair, and webhooks forms render error text in a standalone role="alert" paragraph that is not programmatically tied to the input that failed — e.g. src/app/quote/page.tsx and src/app/pairs/new/page.tsx use bare <label>/<input> with a separate error node. Screen-reader users cannot tell which field is invalid. The repo already has an accessible src/components/TextField.tsx that wires aria-invalid/aria-describedby correctly; this issue brings the forms up to that standard.

Requirements and context

  • Repository scope: StableRoute-Org/Stableroute-frontend only.
  • Refactor the quote and new-pair inputs to use TextField, passing the error prop so aria-invalid and aria-describedby are set on the failing input.
  • Move focus to the first invalid field on a failed submit so keyboard/AT users land on the error.
  • Keep the existing validation rules and role="alert" semantics (now field-scoped where appropriate).
  • Apply the same pattern to the webhooks URL/events inputs in src/app/webhooks/page.tsx.

Suggested execution

Test and commit

  • Run npm run lint, npm test, and npm run build.
  • Cover edge cases: single invalid field, multiple invalid, valid submit clears aria-invalid, and focus lands correctly.
  • Include the full npm test output and a11y notes in the PR description.

Example commit message

a11y: associate form validation errors with fields via aria attributes

Guidelines

  • Minimum 95 percent test coverage for impacted modules.
  • Clear, reviewer-focused documentation.
  • Timeframe: 96 hours.

Community & contribution rewards

  • 💬 Join the StableRoute community on Discord for questions, reviews, and faster merges: https://discord.gg/37aCpusvx
  • ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.

Metadata

Metadata

Assignees

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions