Accessible Form Errors: WCAG 3.3.1, 3.3.3, GOV.UK Pattern
An accessible form error does four things: it says in text that an error occurred, names the field in error, tells the user how to fix it, and keeps everything the user already entered. WCAG 2.2 covers this mainly through four success criteria: 3.3.1 Error Identification (Level A), 3.3.3 Error Suggestion (Level AA), 3.3.4 Error Prevention for legal, financial and data-changing pages (Level AA), and 4.1.3 Status Messages (Level AA); keeping the answers falls under 3.3.7 Redundant Entry (Level A). The GOV.UK Design System turns these into a concrete pattern: an error summary at the top of the page, an error message beside each field, matching wording in both, and focus moved to the summary.
Which criterion covers which part
| Success criterion | Level | What it requires | What it means in a form |
|---|---|---|---|
| 3.3.1 Error Identification | A | If an input error is automatically detected, the item that is in error is identified and the error is described to the user in text | Name the field and state the problem in words; a red border is not enough |
| 3.3.3 Error Suggestion | AA | If an input error is automatically detected and suggestions for correction are known, the suggestions are provided, unless that would jeopardize the security or purpose of the content | Show the accepted format, value or option, not only “invalid” |
| 3.3.4 Error Prevention (Legal, Financial, Data) | AA | For pages causing legal commitments or financial transactions, modifying or deleting user-controllable data, or submitting test responses, at least one of: reversible, checked with a chance to correct, or confirmed before finalizing | A review step, an undo window or a validation pass before payment, deletion or a tax return |
| 4.1.3 Status Messages | AA | In markup, status messages can be programmatically determined through role or properties, so assistive technologies can present them without the message receiving focus | Announce “saving”, “saved” and live validation results without moving focus |
The criteria wording comes from the W3C Understanding documents for 3.3.1, 3.3.3, 3.3.4 and 4.1.3. For the full level structure of WCAG 2.2, see WCAG 2.2 Explained.
SC 3.3.1: identify the field and describe the error in text
The Understanding document for 3.3.1 lists sufficient techniques in two situations. For required fields left empty, they are G83 (text descriptions that identify the required fields that were not completed) and SCR18 (client-side validation and alert). For wrong format or values, they are G84 (text description when input is not in the list of allowed values), G85 (text description when input falls outside the required format or values), SCR18, SCR32 (client-side validation with error text added through the DOM) and ARIA18 (alert dialog). Each situation also lists a PDF technique (PDF5 and PDF22). The page lists no failure techniques for this criterion, so the test is practical: can a person who cannot see colour, and a screen reader user, both learn which field is wrong and why?
The page also lists two advisory techniques, which it describes as not required for conformance: G139, a mechanism for jumping to errors, and G199, success feedback after submission. The GOV.UK error summary below is a G139 mechanism, and the status message section covers G199.
SC 3.3.3: suggest the correction when you know it
The 3.3.1 page draws the line between the two criteria with an email example: “Email is not valid” passes 3.3.1, while “Please provide a valid email address in the format name@domain.com” also says how to fix the entry and passes both. The 3.3.3 page explains the intent: people with cognitive limitations may not know how to fix an error, and people with visual disabilities may not be able to figure out exactly how to correct it, and after a failed submission, users who are unsure how to correct an error may abandon the form. Its example for a month field is concrete. If the user enters “12” where month names are expected, the page can list the acceptable names or ask “Do you mean ‘December’?”
The exception matters for security-sensitive forms. Suggestions can be withheld when they “would jeopardize the security or purpose of the content”. The Understanding page gives no example of the exception, but sign-in is a clear case. OWASP’s Authentication Cheat Sheet says a login must respond with a generic error message whether the user ID or the password was wrong, so that attackers cannot use the difference to find valid accounts. Its correct example is “Login failed; Invalid user ID or password.” Everywhere else, G177 (providing suggested correction text) is the model: show the accepted input next to the problem.
The GOV.UK pattern: summary plus inline message
GOV.UK’s error summary guidance is explicit and testable:
- Always show an error summary when there is a validation error, even if there is only one.
- Use the heading “There is a problem”.
- Move keyboard focus to the summary. The GOV.UK Frontend JavaScript does this automatically.
- Link each error to its answer. For a date, link to the first field containing an error; for radios or checkboxes, link to the first one.
- Word each summary message exactly as the message beside the input.
- Place the summary at the top of the main container, below any breadcrumbs or back link and above the
<h1>.
The error message component adds the inline half: a visually hidden “Error:” prefix inside the message for screen reader users, a red border to connect the message to its question, and the hint and error both referenced by aria-describedby (for example aria-describedby="national-insurance-number-hint national-insurance-number-error"). Its wording rules ask for a description of what happened and how to fix it, used consistently: an instruction for an empty field (“Enter your name”) and a description for an over-long entry (“Name must be 35 characters or less”). The page’s own wrong-format example reads “Enter a National Insurance number in the correct format”. It rejects generic messages such as “This field is required” or “Select an option”.
The GOV.UK validation pattern covers the page around the form. Validation should refuse information that cannot be correct: for a date of birth, do not accept “13” in the month field. When answers fail, add “Error: ” to the start of the page <title> so screen readers read it early, and show the page again with the fields as the user filled them in, so users can see what went wrong and avoid re-entering information. It also says to add novalidate to the form tag, not to use required on inputs, and always to validate on the server, because client-side validation can be bypassed or fail if JavaScript does not load.
W3C’s form notifications tutorial reaches a similar design from a different direction: list errors at the top of the page before the form, with each entry referencing the field’s label, explaining the problem, saying how to correct it and linking to the field. For in-line errors after a submit, it suggests moving focus to the first input in error, whereas GOV.UK moves it to the summary. The G139 technique describes the same mechanism: a summary with links, with a server-redisplayed form that keeps the user’s entries.
Markup: aria-invalid and aria-describedby
The visible message is what meets 3.3.1 and 3.3.3. The 3.3.1 page adds that programmatic error information is not required by that criterion, but may be covered by 4.1.2 Name, Role, Value, for the error state of the input, and by 1.3.1 Info and Relationships, for the connection between the input and its message. This field-level markup provides the message and both connections:
<label for="booking-email">Email address</label>
<div id="booking-email-hint">Use the address for your confirmation.</div>
<p id="booking-email-error">
<span class="visually-hidden">Error:</span>
Enter an email address in the correct format, like name@example.com
</p>
<input id="booking-email" name="email" type="email" autocomplete="email"
aria-invalid="true"
aria-describedby="booking-email-hint booking-email-error">
Three rules come directly from the W3C techniques and the GOV.UK examples:
- Set
aria-invalid="true"only after validation has failed. Technique ARIA21 says the attribute “should not be set to “true” before input validation is performed”, and its test procedure checks both directions: not true when there is no failure, true when there is one. Setting it to"false"has the same effect as omitting it. When the user fixes the value, remove the attribute and the error element. - Reference the error from the control with
aria-describedby, listing the hint first and the error second, as GOV.UK’s examples do, so the description reads hint then problem. Keep the visible text and the referenced text identical. - Label and instruction text must still make the error understandable. ARIA21’s third check is that the field’s label or instructional text gives enough information to understand the error.
For group questions such as dates, radios and checkboxes, put the aria-describedby on the fieldset. GOV.UK’s examples do this for all three: the date example’s fieldset references passport-issued-hint passport-issued-error, the radios error example’s fieldset references whereDoYouLive-error, and the checkboxes example on the error message page references nationality-hint nationality-error. For grouping and labelling basics, see Accessible Form Design.
SC 4.1.3: announce without moving focus
Status messages are changes in content that are not a change of context, and that report the success or result of an action, a waiting state, progress or the existence of errors. The Understanding page lists sufficient techniques for three situations:
| Situation | Technique | Pairs with |
|---|---|---|
| Success, results or application state (“Saved”) | ARIA22: role="status" | G199 success feedback |
| Suggestions or warnings about errors that appear without a focus change | ARIA19: role="alert" or live regions | G83, G84, G85, G177 or G194 |
| Progress of a process | ARIA23: role="log"; ARIA25: a live region for a progress bar; ARIA27: ariaNotify for a progress bar; or ARIA22: role="status" | G193 (help by an assistant in the page), with ARIA22 only |
The page also draws a boundary that is easy to miss. When an error appears in a dialog that takes focus, the dialog is a change of context and does not meet the definition of a status message, and a role of “alert” is only necessary where a change of context does not take place. So if you move focus to the GOV.UK summary after a failed submit, focus movement is what brings the summary to the user’s attention. Live regions are for errors that appear while focus stays where it is, for example an inline check that runs as the user types.
ARIA19 gives implementation cautions. The error container must be present in the DOM on page load for most screen readers to speak it, so inject text into an existing container rather than creating the container together with the message. The technique’s example clears the container before showing new errors, and notes that aria-atomic="true" is necessary to make VoiceOver on iOS read error messages after more than one invalid submission. The W3C tutorial’s guidance for live validation is aria-live="polite" while typing and aria-live="assertive" on leaving a field. The technique is one example approach, and a page can meet 4.1.3 by other means.
For broader ARIA role guidance, see Screen Reader Compatibility.
Validation timing and kept answers
GOV.UK’s validation pattern says not to validate when the user moves away from a field, but to wait until they try to move on, usually with the “Continue” or “Submit” button. It also says to avoid validating a field before the user has finished entering it, because that can cause problems, especially for users who type more slowly, and to add such checks only where user research shows they solve more problems than they cause. Its example is the character count component, which shows an error when the user goes over the limit. The W3C tutorial shows feedback after submit, while typing and when focus leaves a field, with the live-region settings above. Submit-time validation with a summary is therefore the safer default; an in-field check is an exception that research should justify, announced through a live region.
Kept answers are partly a requirement. SC 3.3.7 Redundant Entry (Level A) says information previously entered by or provided to the user that is required to be entered again in the same process is either auto-populated or available to select. The exceptions are re-entry that is essential, information required for security, and information that is no longer valid. The criterion’s own checkout example applies this to a failed submission: after an incorrect credit card number, the page shows an error, and submitted information, such as the card number, is not cleared from the form. GOV.UK’s error message page states the same instruction plainly: do not clear form fields when showing an error, and keep both passing and failing answers.
Worked examples
| Situation | Weak version | Accessible version | Criteria and techniques |
|---|---|---|---|
| Empty required email | Red border; “Required" | "Enter your email address” in the summary and beside the field, with aria-describedby from the field to the message | 3.3.1 (G83), GOV.UK instruction pattern |
| Date with month “13" | "Invalid date" | "Date of birth must be a real date” linked to the month field; the date fieldset references the error; inputs with errors get the error styling | 3.3.1 (G84, G85), 3.3.3 (G177), GOV.UK date input wording |
| Month typed as “12” where names are expected | ”Invalid month" | "Do you mean December?” or a list of accepted month names | 3.3.3 example in the W3C page |
| Over-long name | Red border only | ”Name must be 35 characters or less” | 3.3.1 (G85), GOV.UK wording rule |
| Payment or tax return submit | Submit immediately | A review page (G98), a confirmation checkbox beside the submit button (G155), or a stated time to amend or cancel (G164) | 3.3.4 Situation A (G98, G155, G164) |
| Delete account data | One-click delete | A confirmation step or undo | 3.3.4 Situation B (G99, G168, G155) |
| Sign-in failure | ”Wrong password for this email” | One generic message, such as “Login failed; Invalid user ID or password.” | 3.3.3 security exception, OWASP generic response |
| Save in progress and done | Spinner only | ”Saving” then “Saved” in a role="status" region, without moving focus | 4.1.3 (ARIA22, G199) |
| Server unavailable after a valid submit | Mark the field invalid | Say the service failed and what happened to the answers, keep them, and give a contact route | Not an input error; GOV.UK service-problem pattern; 4.1.3 if shown in place |
The last row separates a data error from a service failure. WCAG defines an input error as information provided by the user that is not accepted, so a correct email address should never carry aria-invalid="true" because the server did not answer. GOV.UK keeps the two apart: its error message guidance says not to use error messages for problems the user cannot fix, and its problem with the service pattern asks for “Try again later.”, information about what has happened to the user’s answers, contact information where it exists, and answers stored so the user can resume the journey later. If you report the failure on the same page instead, use a status message about the action and keep the answers. For an uncertain outcome, give the user a way to check the status before another submission duplicates the action.
Retest checklist
- Submit with every required field empty. Is there one summary, focus on it, a title that starts with “Error: ”, and a link for each field?
- Activate each summary link. Does focus land in the control, and does the next Tab continue from there? Keyboard behaviour in general is covered in Keyboard Accessibility.
- Inspect each field in error:
aria-invalid="true",aria-describedbylisting hint then error, and noaria-invalidon valid fields. - Compare the summary text with the inline text. They should be identical.
- Correct one field and resubmit. Does the old error disappear from the DOM and the accessibility tree, and are the other answers still filled in?
- Zoom a 1280-pixel-wide browser window to 400 percent, which equals the 320 CSS pixel width that SC 1.4.10 Reflow (Level AA) uses. Does each message wrap without overlapping the next field or needing sideways scrolling? A suggested extra case is a longer message, such as a translation.
- For a live-region path, check that the container exists at load and the message is spoken once.
- For legal, financial or deleting actions, confirm that at least one 3.3.4 option exists: reversible, checked, or confirmed.
Sources
- W3C: Understanding SC 3.3.1 Error Identification
- W3C: Understanding SC 3.3.3 Error Suggestion
- W3C: Understanding SC 3.3.4 Error Prevention (Legal, Financial, Data)
- W3C: Understanding SC 4.1.3 Status Messages
- W3C: Understanding SC 3.3.7 Redundant Entry
- W3C: Understanding SC 1.4.10 Reflow
- W3C: ARIA21, using aria-invalid to indicate an error field
- W3C: ARIA19, role=alert or live regions to identify errors
- W3C: G139, a mechanism that allows users to jump to errors
- W3C WAI: form notifications tutorial
- GOV.UK Design System: Error summary
- GOV.UK Design System: Error message
- GOV.UK Design System: Validation pattern
- GOV.UK Design System: Radios
- GOV.UK Design System: Date input
- GOV.UK Design System: There is a problem with the service pages
- OWASP Cheat Sheet Series: Authentication