download

A form shows red borders and a 3-second toast. What breaks?

Product and UX~8 minReviewed 2 Dec 2026Free · No sign-in

Question

A signup form has 3 fields: Work email, Team size, and Password (minimum 12 characters). A user submits ana.acme.com (missing @) and a 5-character password. The app does three things:

  • Turns the two field borders red.
  • Clears both invalid inputs and leaves focus on the Submit button.
  • Shows a floating toast ("Fix the errors above") in a plain <div> that vanishes after 3 seconds.
  1. Which WCAG 2.2 criteria does this break, and for whom?
  2. Design the error UI, ARIA attributes, and focus flow to fix it.
Show hints (3)
  1. "CHECK FOUR WCAG RULES"

    Think about color-only cues (1.4.1), naming which field failed (3.3.1), telling how to fix it (3.3.3), and announcing updates (4.1.3).

  2. "WIRE INPUTS TO TEXT"

    How does a screen reader know a field is invalid and which inline message belongs to it?

  3. "PLACE FOCUS INTENTIONALLY"

    A disappearing toast leaves keyboard users stuck on Submit. Put a persistent error summary at the top and move focus there.

Show checked explanation

It fails WCAG 2.2 criteria 1.4.1 (Use of Color), 3.3.1 (Error Identification), 3.3.3 (Error Suggestion), and 4.1.3 (Status Messages). Replace the 3-second toast with a persistent top error summary that receives focus, link each bad input to a specific inline fix via aria-invalid="true" and aria-describedby, and keep non-secret input.

WCAG 2.2 criteria mappings and the HTML/ARIA markup structure, summary links, and ID references were parsed and checked with Python 3.12. Checked by an editor other than the author.

Walkthrough

Each shortcut in the current form blocks real people from finishing signup.

Current behaviorWCAG 2.2 criterionWho gets blocked
Red border only1.4.1 Use of Color (A)Color-blind or low-contrast users cannot spot bad fields
Generic "Fix the errors above"3.3.1 Error Identification (A)Screen reader and zoomed users do not know which fields failed
No format guidance3.3.3 Error Suggestion (AA)Users do not learn the @ or 12-character rule
Plain <div> toast gone in 3 s4.1.3 Status Messages (AA)Assistive tech misses the alert; slow readers lose it

Replace it with three linked parts:

  1. Persistent error summary at the top. Focus an outer container with tabindex="-1" on submit, and wrap the summary text and anchor links inside a nested role="alert" box (the GOV.UK pattern avoids screen reader cutoff).
  2. Specific inline messages wired with ARIA. Place a fix next to each failing field and wire it with aria-invalid="true" and aria-describedby.
  3. Preserve non-secret input. Keep valid entries and non-secret values like ana.acme.com so users can edit instead of retyping. Client-side checks can keep a password while editing, but never echo raw passwords in server-rendered HTML.
"HTML"
<div id="err-sum" tabindex="-1">
  <div role="alert">
    <p>There is a problem</p>
    <ul>
      <li><a href="#work-email">Enter a valid work email</a></li>
      <li><a href="#password">Use 12 or more characters</a></li>
    </ul>
  </div>
</div>
<label for="work-email">Work email</label>
<input id="work-email" type="email" aria-invalid="true"
       aria-describedby="email-error" value="ana.acme.com">
<p id="email-error">Error: include an @ sign, like [email protected].</p>
<label for="password">Password</label>
<input id="password" type="password" aria-invalid="true"
       aria-describedby="password-error">
<p id="password-error">Error: use at least 12 characters.</p>

Pair the red border with the visible "Error:" prefix or an icon. Keep existing hint IDs in aria-describedby (space-separated) so helper text is not overwritten.

Common mistakes

  • Setting aria-invalid="true" on empty fields before the user submits. Screen readers then announce errors before anyone types.
  • Using an auto-dismissing toast for form validation. Users who magnify the screen or read slowly lose the message before fixing the field.
  • Writing vague messages like "Invalid input" instead of stating the rule (missing @, or 12-character minimum).
  • Wiping non-secret fields like work email or echoing raw passwords in server HTML. Keep safe entries editable without exposing secrets.

Follow-up questions

  • "Should you validate every field as the user types or on submit?" Validate on submit by default so you do not interrupt typing with premature error alerts. Once a field is flagged after submit, clearing its error state live as the user fixes it gives helpful confirmation without nagging.
  • "If the form has only 2 or 3 fields, should focus go to the error summary or the first invalid field?" Moving focus to a top error summary works consistently on every form size and gives an immediate count of all errors. On a very short form, focusing the first invalid input is acceptable if a live region also announces the total error count.

What a strong answer covers

Maps all four WCAG 2.2 failures (1.4.1, 3.3.1, 3.3.3, 4.1.3). Replaces the 3-second toast with a focused error summary, wires inline fixes with aria-invalid and aria-describedby, and keeps non-secret input.

Open in interactive practice deck →

Original OfferVibe question. WCAG 2.2 · WAI forms notifications · GOV.UK error summary · MDN aria-invalid.
© 2026 OfferVibe · Text CC BY-NC-SA 4.0 · code MITFree to share and adapt with credit, not for commercial use. Code samples are free for any use.