FeaturesPricingAudit GuideFree StatementDashboard →

Identify and Explain Form Errors Clearly

Learn how to provide clear, accessible error messages and validation feedback. Includes code examples and best practices.

6 min read
serious severityWCAG Level AWCAG 2.1 Success Criterion 3.3.1 and 3.3.4Manual review needed

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.

Automated detection: Run a free SiteArmor scan to automatically detect this issue across your entire website. Check your site →

Code Examples & Fixes

HTML / CSS

Before (inaccessible)
<input type="email"> <span style="color: red">Invalid</span>
After (accessible)
<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

Before
input.style.borderColor = "red"; // error state
After
const [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

Before
Form submitted, fields turn red, generic "Error" message shown at top
After
Form 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

Before
Cart page shows "Error updating cart" without explanation
After
Cart 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?
aria-invalid="true" marks field as invalid. aria-describedby links the field to its error message element (the explanation).
Should errors be announced immediately or after submit?
Both are acceptable. Real-time validation helps users fix errors before submitting. But don't overwhelm users with instant errors while they're typing.
How should error messages be styled?
Use multiple indicators: color (red) + icon (✗) + text. Don't rely on color alone. Ensure contrast ratio of at least 3:1.
What's role="alert"?
role="alert" tells screen readers to announce content immediately when it appears. Use for time-sensitive info like errors. Other options: role="status" (less urgent updates).

Check your website for free

Get your ADA, WCAG, privacy & security score in 90 seconds.

No credit card
WCAG 2.1
ADA
Privacy

Related guides