← All Exercises
Announce Form Errors with a Linked Summary
intermediatehtml
Background
An error summary gives keyboard and screen reader users one place to review every problem before fixing fields.
Problem
Build a sign-up form whose error summary receives focus after a failed submission, lists links to each invalid field, and marks those fields with aria-invalid and an inline message.
Input
A sign-up form with email and password fields plus two validation errors.
Output
A focusable alert summary and fields described by their error messages.
Sample tests
Sample 1
Input: User submits the form with both fields empty
Expected: summary role=alert is focused, lists links to #email and #password, and both inputs expose aria-invalid=true
Sample 2
Input: Screen reader moves to the email input
Expected: the input announces invalid and reads its inline error through aria-describedby=email-error
Your solution
Learning objective
Connect an error summary, invalid fields, and inline messages into one navigable validation experience.