← Back to Design Systems and Frontend Team
See how it helps
Accessible forms and errors
Designs forms with persistent labels, useful instructions and validation errors that people can find and correct.
accessible-forms-validation
Team members using this skill
When is it useful?
Use when registration or settings forms leave users guessing what is required or why submission failed.
What does it help you do?
- Groups related inputs and supplies suitable autocomplete and mobile input hints.
- Associates specific errors with fields and moves focus to actionable feedback.
- Prevents duplicate submissions while preserving clear loading feedback and keyboard access.
Try asking this
Review our registration form, including missing fields, server rejection, password pasting and navigation from the error summary. After a rejected email address, keep the other entries and link the error to that field. Repeated clicks must not create duplicate registrations.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Accessible Forms & Validation
Forms are where users create accounts, configure settings, enter payment details and complete core workflows. Every field must state clearly what input is expected, whether it is required, why validation failed and how to recover (WCAG 1.3.1, 1.3.5, 2.4.6, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.7, 3.3.8).
1. Labels, Instructions & Grouping
- Persistent visible
<label>: every<input>,<select>and<textarea>needs a permanently visible<label for="field-id">(or explicitaria-labelledbywhen a visible heading acts as the label). - Never use
placeholderas the only label: placeholders disappear as soon as the user types, strain short-term memory, often fail4.5:1contrast, and are not treated as reliable accessible names across all assistive technologies. - Format hints & helper text: place formatting rules (e.g.,
"Use YYYY-MM-DD","Minimum 12 characters") in visible text above or adjacent to the input and link them viaaria-describedby="hint-id"before the user submits. - Group related controls (
<fieldset>+<legend>):- Wrap radio button groups, checkbox groups, date parts (Day / Month / Year) and repeated address blocks (Shipping vs. Billing) in a
<fieldset>with a concise<legend>(orrole="group"/role="radiogroup"witharia-labelledby). - Without a group legend, a screen reader user hears "Yes, radio button 1 of 2" without knowing what question "Yes" answers.
- Wrap radio button groups, checkbox groups, date parts (Day / Month / Year) and repeated address blocks (Shipping vs. Billing) in a
- Input purpose & cognitive support:
- Set appropriate
type(email,tel,url,number,search,password) andinputmode(numeric,decimal) so mobile keyboards match the data. - Add standard
autocompleteattributes (name,email,username,current-password,new-password,one-time-code,street-address,cc-number) on personal data fields (WCAG 1.3.5). - Never block paste (
onpasteprevention) on password or verification fields (WCAG 3.3.8 Accessible Authentication).
- Set appropriate
2. Error Identification, Association & Focus Management
When client-side or server-side validation fails:
- Mark invalid fields programmatically: set
aria-invalid="true"on the offending input(s) (and removearia-invalidor set"false"once corrected). - Associate the error message with the field:
- Render a visible, specific error message next to the field (
<p id="email-error">Enter a valid work email address, including '@'</p>). - Reference the error ID in
aria-describedby="email-hint email-error"(oraria-errormessagewhere supported alongsidearia-describedby), keeping both helper text and error text linked. - Do not rely on red border color alone — include text and an icon (
aria-hidden="true") alongside the message (WCAG 1.4.1).
- Render a visible, specific error message next to the field (
- Move focus predictably on submit failure:
- For short forms: move focus directly to the first invalid input so the user hears the field label,
invalid entry, and its linked error message immediately. - For long or multi-section forms: render an Error Summary at the top of the form (
role="alert"or focused container withtabindex="-1"and a heading like"There are 3 problems with your submission"), where each item is an anchor link (<a href="#field-id">) that jumps focus directly to the corresponding invalid field.
- For short forms: move focus directly to the first invalid input so the user hears the field label,
3. Disabled Submit Buttons vs. Helpful Validation
- Avoid disabling the primary Submit button silently while the user is still filling out a complex form — disabled buttons cannot receive keyboard focus by default and give no explanation of why submission is blocked.
- Prefer allowing submission and guiding the user directly to the missing or invalid field with a clear error message.
- During in-flight submission (
pendingstate), prevent duplicate submits while keeping focus stable (aria-disabled="true"oraria-busy="true"with visible loading feedback).
Included files 1
SKILL.md
