Explore behaviors before defining the interface.
Quick guide for designers
Always consider the context of the application, even when the guidance follows a standard pattern. Interaction design documents intent. Behavior must be verified in the implementation.
When to use
Use to explain input problems and guide corrections. Service failures need their own messages.
What to draw
Show instructions, field-level errors, and a linked summary where appropriate. Explain corrections in text beyond color or icons.
How it behaves
Preserve values after invalid submission. Summary links lead to the field. Do not show errors before the person has had a chance to enter data.
What to document in Figma
Define validation timing, focus after invalid submission, and announcements. For asynchronous checks, consider the current value and avoid stale responses.
How to review
Check whether the purpose and states are clear on small and large screens and with zoom. Verify documented behavior in the implementation, including keyboard and screen reader use where applicable.
Full guidance
Interaction Design
Questions to ask when designing form validation messages.
Assess each guideline in context. Validation reports entry problems and guides correction; service failures require their own messages.
Designing for "no interaction"
- Are instructions, expected formats, and required fields clear before entry?
- Does the message identify the field, explain the problem, and say how to correct it without blaming the person?
- Are errors identifiable through text as well as color or icons?
- Has validation timing been defined: on submission, on leaving a field, or during a specific check? Are errors avoided before the person has had a chance to enter information?
Designing for mouse use
- Does the message stay near the field and available while the error remains?
- If there is an error summary, do its links lead to the corresponding fields?
Designing for gesture use
- Can the message be read and the field corrected even with the virtual keyboard open or zoom enabled?
- Do summary links have adequate touch areas?
Designing for keyboard use
- After an invalid submission, is there a predictable focus destination, such as the error summary or first invalid field?
- Can summary links be navigated with
Taband activated withEnter? - Does validation during editing preserve focus and allow typing?
Designing for screen reader use
- Is the message associated with the field and its invalid state identified?
- Are new errors communicated without excessive repetition or announcements on every key?
- Does the summary have a clear title and links with names identifying the problems?
Interaction methods
Mouse interaction
- On submitting invalid data, display specific messages next to fields and, when appropriate, a summary with correction links.
- Clicking a summary link leads to the corresponding field on the same page and positions focus for correction.
- Preserve entered data, including values needing correction.
Keyboard interaction
TabandShift + Tabmove through fields, the submit button, and summary links in interface order.EnterorSpaceactivates the submit button;Enteractivates summary links.- After a rejected submission, place focus on the summary or first invalid field according to the chosen pattern.
- During validation on leaving a field or while editing, maintain focus flow and text entry.
Gesture interaction
- Tapping the submit button allows form validation.
- Tapping a summary link leads to the field; the message remains available for consultation and correction.
Keyboard (or gesture) interaction + screen reader
- When navigating to an invalid field, present its label, error indication, and associated message through
aria-describedby, while preserving the association with instructions. - Use
aria-invalidto indicate a detected error; update the state when the error is corrected and new validation confirms the correction. - If focus moves to a summary, allow its title, errors, and links to be read. If focus stays where it was, announce dynamic errors through an update region appropriate to the context.
- Avoid announcing the same message simultaneously through focus and several
aria-live.
Correction and resubmission
- After a confirmed correction, remove or update the message and corresponding summary entry without clearing other errors.
- Resubmitting performs the necessary validation; confirm success only after the operation completes.
- For asynchronous checks, communicate progress and prevent old responses from replacing the result for the current value.
Gherkin
BDD (Behavior-Driven Development) methodology focusing on three pillars: User Stories, Acceptance Criteria, and Gherkin Syntax (Given, When, Then).
Scenario: Given that I am on a page containing a form with validation
Keyboard navigation
- WHEN I use
Tabkey to move focus to the submit button - The focus I SEE is strongly indicated visually
- THEN, when I use
EnterorSpaceto submit invalid data - I SEE messages identifying fields with errors and explaining how to correct them
- AND I perceive focus moved to the summary or first invalid field according to the defined pattern
- WHEN I use
Tabto focus a summary link andEnterto activate it - I SEE focus reach the corresponding field on the same page and I can correct it
Desktop screen reader
- WHEN I use a screen reader on a computer (NVDA, JAWS, VoiceOver) and submit a form with invalid data
- I HEAR or perceive that submission was not completed and there are errors to correct
- THEN, when I use
Tabto navigate to an invalid field - I HEAR its label, error indication, and correction guidance
- AND, when I use
Enterto activate a summary link, I perceive that I reached the corresponding field - I HEAR or perceive messages without unnecessary duplicate announcements
Mobile screen reader
- WHEN I use a screen reader on a phone (TalkBack, VoiceOver) and submit a form with invalid data
- I HEAR or perceive that submission was not completed and there are errors to correct
- THEN, when I swipe to navigate to an invalid field
- I HEAR its label, error indication, and correction guidance
- AND, when I double-tap or use the appropriate gesture to activate a summary link, I perceive that I reached the corresponding field
- I HEAR or perceive messages without unnecessary duplicate announcements
Correction and resubmission
- WHEN I correct a field and new validation confirms the correction
- I SEE that field's message and invalid state updated, preserving other errors and entered values
- THEN, when I submit the form with all valid entries
- I SEE or HEAR confirmation only after the operation completes
Validation while editing
- WHEN validation occurs on leaving a field or during a specific check
- I SEE or HEAR a message at the defined time without premature errors before entry
- AND I perceive that focus and typing were not interrupted
Considerations
- Prefer concrete messages, such as "Enter an email in the format name@example.com", rather than just "Invalid value".
- Distinguish empty required fields, incorrect formats, and business rules. Do not treat connection failures or unavailable services as entry errors.
- Do not rely solely on red borders, icons, or temporary messages. Keep guidance until the correction is confirmed.
- Associate the error with the field using
aria-describedbyand preserve existing instructions in that association. Usearia-invalidonly when an error is detected. - The summary complements messages next to fields. Its links must tell screen reader users that they lead to fields on the same page and move focus to the appropriate destination.
- Choose between a focus announcement and a dynamic region according to the flow. Use
role="alert"only when urgency justifies it;role="status"may serve for nonurgent updates. Avoid announcements on every key. - Preserve values after an invalid submission. Do not include passwords or other sensitive data in summaries or status messages.
- Client-side validation helps provide guidance, but server-side validation remains necessary. Asynchronous checks must consider the current value and report check failures.
- Do not disable the submit button as the only indication of problems: the person needs to know what is missing and how to correct it.
- For supplementary icons, prefer Material Icons and hide decorative ones from assistive technologies; the information must remain available in text.
- Bootstrap documents accessibility limitations in its custom client validation styles and tooltips. Evaluate examples before adopting them; colors and styles do not guarantee accessible association or announcements.
References
Design patterns
- W3C WAI — User Notification open_in_new (external link, opens in a new tab) — Errors, notifications, and feedback after form submission.
Design System
- GOV.UK — Error message open_in_new (external link, opens in a new tab) — Messages associated with fields and correction guidance.
- GOV.UK — Error summary open_in_new (external link, opens in a new tab) — Error summary, links to fields, and focus management.
- USWDS — Validation open_in_new (external link, opens in a new tab) — Validation and feedback on entry requirements.
- Bootstrap — Validation open_in_new (external link, opens in a new tab) — Validation examples and documented accessibility limitations.