Identify and Explain Form Errors Clearly
Learn how to provide clear, accessible error messages and validation feedback. Includes code examples and best practices.
What Is It?
Error identification means forms explicitly identify invalid fields and explain what's wrong. Errors must be announced to screen readers, not just shown in color. Messages must suggest corrections.
Affected users: Users with cognitive disabilities, dyslexia, ADHD, color-blind users, screen reader users, users on mobile devices with small screens
Why It Matters
Users with cognitive disabilities, dyslexia, or ADHD need clear error explanations. Color-blind users won't see red error text if color is the only indicator. Screen reader users need announcements.
How to Detect This Issue
Fill form incorrectly and submit. Check if errors are announced by screen reader. Verify messages explain what's wrong and how to fix. Check messages aren't color-coded only.
Code Examples & Fixes
HTML / CSS
<input type="email"> <span style="color: red">Invalid</span><label for="email">Email</label> <input type="email" id="email" aria-describedby="email-error"> <span id="email-error" role="alert">Error: Please enter a valid email address</span>Error message has unique id, aria-describedby links input to error, role="alert" announces error to screen readers. Text explains what's wrong.
React / Next.js
input.style.borderColor = "red"; // error stateconst [error, setError] = useState(""); return (<> <input onChange={handleChange} aria-describedby={error ? "error" : undefined} /> {error && <div id="error" role="alert">{error}</div>} </>);Use role="alert" to announce errors. Connect input to error message with aria-describedby. Use JavaScript state to manage error messages.
WordPress
Form submitted, fields turn red, generic "Error" message shown at topForm submitted, each invalid field gets aria-invalid="true", specific error message appears below field: "Password must be at least 8 characters"Use form validation plugins that provide accessible error handling. Ensure error messages are specific and actionable.
Shopify Liquid
Cart page shows "Error updating cart" without explanationCart page shows specific error: "Item quantity for Blue T-Shirt (size XL) exceeds available stock. Maximum 3 units available."Shopify liquid: show specific error messages that tell customers exactly what needs to be fixed. Use aria-live regions to announce updates.
Common Mistakes
Using color alone to indicate errors (red text only, no explanation)
Generic error messages: 'Error', 'Invalid input' without specifics
Error messages that don't suggest fixes: 'Invalid format' vs 'Enter date as MM/DD/YYYY'
Errors not announced to screen readers (no role="alert")
Error messages placed far from the field they describe
Frequently Asked Questions
What's the difference between aria-invalid and aria-describedby?
Should errors be announced immediately or after submit?
How should error messages be styled?
What's role="alert"?
Check your website for free
Get your ADA, WCAG, privacy & security score in 90 seconds.