How to Design Form Errors People Can Fix
Disclosure: This educational guide was prepared with AI assistance for Marcelo Cedeño, founder of HorizonX. It is not an independent assessment of its library, and we have not tested paid downloads. This is the English version of our Spanish guide to recoverable form errors.
A form can look finished and fail exactly when a person needs help. If selecting Continue produces only a red border or reloads the page, how does someone know what to change? Evaluate the recovery experience, not just the empty screen.
Start with two fields and one submission
Imagine a contact form requiring a name and email address. Design and document at least these states: both fields empty; an email with an unexpected format; one error corrected while another remains; a server failure; and a successful submission. Different problems need different messages, and a failed submission should not automatically erase what someone typed.
WCAG's guidance on error identification and error suggestions provides a useful foundation: identify the affected item and describe the problem in text; when a correction is known, suggest it unless doing so would jeopardize security or the purpose of the content.
Use a summary and specific field messages
When a submission has several errors, a summary near the beginning can say “Check these two fields” and link each problem to its control. Beside the email field, say “Enter an email address such as name@example.com” rather than “Invalid input.” Keep the existing label and instructions. Color and an icon can reinforce the message, but should not be the only signal.
A server error is different: “We couldn't send your message. Try again” does not imply the email is wrong. Preserve entered data when safe and offer a way to retry. Avoid disclosing sensitive information merely to make an error more specific.
Connect the design to markup
Associate a label with the input. When validation finds an invalid value, communicate the state with aria-invalid="true" and connect the error text with aria-describedby. The following illustrates the state after detecting an error, not a complete form:
<label for="email">Email address</label>
<input id="email" name="email" type="email" required
aria-invalid="true" aria-describedby="email-error">
<p id="email-error">Enter an email such as name@example.com.</p>
Update or remove the invalid state and message when appropriate, retain links to other instructions and validate on the server too. Browser behavior and announcement strategies vary. Read MDN's guides to aria-invalid and aria-describedby, and the W3C's form notification guidance. Test with actual assistive technology: adding attributes alone does not prove conformance.
Decide where focus goes
After submission with multiple errors, one option is to move focus to a focusable error summary with links to each control. For a very short form, another is to focus the first invalid field. Avoid moving focus while someone is typing, and test for duplicate announcements or unnecessary interruptions. Document the decision for design and development.
What to ask of a UI library
Before adopting a component, check whether its files or documentation show labels, help text, errors, focus and disabled states, and how those states work in code. A visual listing alone does not prove the final component is accessible. For example, HorizonX's Liquid Glass is described as an editable Figma kit that includes a help field and buttons; its download requires membership. We have not checked which error variants are included in the paid file, so inspect them before relying on it.
Before handing off
- Submit empty fields and check that each problem has identifiable text and a useful correction when one is known.
- Use only the keyboard: confirm visible focus and the ability to reach and correct each error.
- Test with a screen reader: the label, instructions, state and message should make sense together, including after correction.
- Trigger a server failure in a test environment and check that input is not unexpectedly lost.
- Record the library, license and changes, then repeat the test in the integrated product.
A polished screenshot can help select a visual direction. Completing, failing and correcting the real implementation is the test that reveals whether the experience works.
Comments
Post a Comment