ARIA21: Using aria-invalid to Signal Form Errors
Patricia · AI Research Engine
Analytical lens: Risk/Legal Priority
Government compliance, Title II, case law
AI-assisted · Source-linked · Editorially reviewed · Methodology
Trust note
This article was drafted with AI assistance, reviewed against accessibility.chat editorial standards, and should be treated as research and education rather than legal advice. We prioritize primary sources and correct material errors.

You submit a form. Nothing happens — or so it seems. For a sighted user, a red border and an error message are obvious. For someone using a screen reader, a silent validation failure isn't a minor inconvenience. It's a wall. WCAG Technique ARIA21 (opens in new window) exists precisely to tear that wall down.
This is one entry in W3C's official WCAG 2.2 techniques catalog — not a workaround, not a best practice from a blog post, but a formally documented, standards-backed approach to communicating form errors programmatically. The technique is straightforward. Its absence is consequential.
The Technique
ARIA21 describes how to use the aria-invalid attribute to identify form fields that have failed validation. The W3C's official documentation (opens in new window) frames this as a sufficient technique for meeting Success Criterion 3.3.1 Error Identification (opens in new window), which requires that when an input error is automatically detected, the item in error is identified and the error is described to the user in text.
The core logic is simple: aria-invalid starts as false (or absent) when a form loads. When validation runs and a field fails, JavaScript sets it to true. Assistive technologies — screen readers, primarily — pick up that state change and announce it to the user.
One critical rule from the W3C source: do not set aria-invalid="true" before validation runs. Pre-marking fields as invalid before the user has touched them creates a hostile experience and misrepresents the field's actual state.
Why This Matters
SC 3.3.1 sits within WCAG's broader principle of Understandability (opens in new window) — the idea that users must be able to understand what went wrong and how to fix it. For screen reader users, this principle lives or dies in the DOM.
When aria-invalid is absent after a failed submission, here's what happens: the screen reader user hears nothing new. The form may visually display errors through color changes, icons, or inline messages — none of which are perceivable without sight. The user has no programmatic signal that anything is wrong. They may re-submit, wait, assume the form is broken, or abandon the task entirely.
For keyboard-only users navigating a long form, the same problem applies. Tabbing through fields without any auditory or programmatic indication of which ones failed is disorienting. The cognitive load compounds quickly — especially for users with cognitive disabilities who need clear, explicit feedback to complete tasks successfully.
This isn't a theoretical concern. Our research on testing methodology gaps shows that automated tools catch at most 37% of accessibility failures in comprehensive audits. Form validation state — a dynamic, JavaScript-dependent condition — is exactly the kind of issue that slips through automated scans and only surfaces through manual testing with assistive technology.
How It Works
The W3C source provides a complete working pattern. Here's the essential structure:
Initial HTML state (before validation):
<form name="signup" id="signup" method="post" action=""> <p id="errors" aria-live="assertive"></p> <div> <label for="first">First Name (required)</label> <input aria-invalid="false" autocomplete="given-name" id="first" name="first" type="text"> </div> <div> <label for="last">Last Name (required)</label> <input aria-invalid="false" autocomplete="family-name" id="last" name="last" type="text"> </div> <div> <label for="email">Email (required)</label> <input aria-invalid="false" autocomplete="email" id="email" name="email" type="text"> </div> <div> <button id="button" type="submit">Sign Up</button> </div></form>Several things are worth noting in this pattern:
- The
aria-live="assertive"region at the top of the form means error messages injected there will be announced immediately by screen readers — without requiring the user to navigate to them. autocompleteattributes are present, which supports SC 1.3.5 Identify Input Purpose (opens in new window) — a separate but complementary requirement.- The
aria-invalid="false"initial state is explicit, signaling to assistive technology that the field is currently valid.
When validation runs and a field is empty, JavaScript updates the attribute:
// After validation detects an empty required field:document.getElementById('first').setAttribute('aria-invalid', 'true');The screen reader then announces the field as invalid when the user navigates to it — or, if focus is managed to the error region, immediately upon submission.
| Attribute State | Meaning to AT | When to Use |
|---|---|---|
aria-invalid="false" | Field is valid | Initial load; after correction |
aria-invalid="true" | Field has an error | After validation detects failure |
| Attribute absent | Same as false | Acceptable, but explicit is better |
| Set before validation | Incorrect state | Never — misleads users |
Applying This
In code review: Check that aria-invalid is never set to true in static HTML. It should only appear as true as a result of JavaScript validation logic. If a reviewer sees aria-invalid="true" hardcoded in a template, that's a defect.
In automated testing: Most automated tools will not catch missing aria-invalid on a form that looks valid on load. The failure only surfaces when validation runs and the state doesn't update. This is a manual testing requirement — run validation with intentionally bad inputs and verify with a screen reader (NVDA + Firefox, JAWS + Chrome, VoiceOver + Safari are the standard combinations).
In design: Error states need to be designed with aria-invalid in mind from the start. If your design spec shows a red border as the only error indicator, that's a 1.4.1 (Use of Color) failure and it won't work with aria-invalid alone. The complete pattern requires: aria-invalid="true" on the field, a visible text error message, and ideally an aria-describedby linking the field to its error message.
Quick win vs. longer fix: Adding aria-invalid to existing JavaScript validation logic is often a quick win — a one-line addition per field. The longer fix is architectural: building a validation system that manages ARIA state, focus management, and live region announcements as a unified pattern rather than bolting them on separately. Our research on compliance implementation challenges consistently shows that piecemeal fixes create new gaps. A systematic validation component pays dividends across every form on the platform.
One more thing: aria-invalid supports values beyond true and false. The attribute accepts grammar and spelling as well — useful for text editors or writing tools where the type of error matters to the user experience. For standard form validation, true is sufficient.
CORS Perspective
Through a Risk/Legal Priority lens, aria-invalid sits squarely in the medium-risk, high-frequency zone: it's not a dramatic architectural failure, but SC 3.3.1 is a Level A requirement — the baseline. Failing Level A on form validation in a government service or e-commerce checkout creates real legal exposure under Title II (opens in new window) and Title III respectively, particularly as DOJ's web accessibility guidance under 28 CFR Part 35 (opens in new window) becomes more enforcement-active. The strategic case is equally clear: forms are where organizations collect data, process transactions, and serve users — a broken form validation pattern doesn't just fail an audit, it fails the people trying to use the service. As our research on post-settlement compliance failures shows, organizations that treat ARIA techniques as checkbox items rather than user-centered design decisions tend to cycle back into litigation. The fix here is genuinely simple. The cost of not fixing it — measured in excluded users and legal exposure — is not.
About the Patricia lens
A risk and legal lens. Frames findings around regulatory exposure, drawing on Title II obligations, published case law, and government compliance requirements.
Patricia is an AI analyst lens, not a human staff member. It helps frame this article through a consistent accessibility perspective.
Specialization: Government compliance, Title II, case law
View all articles using this lens →Primary source reviewed: https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA21 (opens in new window)
Transparency Disclosure
This article was drafted with AI assistance and reviewed against our editorial methodology. We disclose that process so readers can judge the work clearly.