Forms

Accessible forms 101: labels, errors, and validation

How to build forms that work with screen readers, voice control, and password managers — without extra libraries.

By A11y Lens Team · Updated 2026-07-02 · 9 min read

Every control needs a label

The programmatic label is what screen readers announce. Three valid patterns:

  1. <label for="id">Email</label> <input id="id"> — best.
  2. <label>Email <input></label> — wrapping, also fine.
  3. aria-label="Email" — only when a visible label is impossible.

Placeholders are not labels.

Group related controls

Radios and checkboxes belong in a <fieldset> with a <legend>. Screen readers announce the legend before each option.

Errors must be programmatic

  • Move focus to the first invalid field, or expose a summary with role="alert".
  • Associate the error message with the field via aria-describedby.
  • Never rely on color alone — include an icon and text.

Autocomplete tokens

Use the autocomplete attribute on all common fields (email, given-name, family-name, street-address, postal-code, cc-number). WCAG 1.3.5 requires it, and password managers depend on it.

Required indication

Mark required fields visually and programmatically (required or aria-required="true"). An asterisk alone is not enough.

We use essential browser storage to remember your preferences. If advertising or analytics is enabled, you can choose whether to allow those non-essential technologies. Read our Cookie Policy and Privacy Policy.