Skip to content

An accessible web form checklist: labels, errors and focus

A practical checklist for forms everyone can use: real labels, clear errors, keyboard focus, autocomplete and no hidden traps.

2 min read

On this page

A form is often the most important part of a page, and the part most likely to shut people out. A missing label, an error shown only in red, or a custom dropdown that ignores the keyboard can stop someone from sending you a message at all. The good news is that accessible forms are mostly plain HTML used well. This checklist covers what matters most.

Labels

  • Give every input a visible <label> tied to it with for and id. Clicking the label then focuses the field, and screen readers announce it.
  • Do not use placeholder text as the label. It disappears as soon as someone types, and its low contrast is hard to read. Use the placeholder for an example instead.
  • Group related choices, such as radio buttons, in a <fieldset> with a <legend> that asks the question.
  • Mark required fields in the label text, not only with color or an asterisk.

Input types and autocomplete

  • Use type="email", type="tel" and type="url", so phones show the right keyboard.
  • Add autocomplete values such as name, email and tel. Browsers can then fill the form in one step, which helps everyone and especially people with motor or memory difficulties.

Errors

  • Show each error next to its field, in text, and connect it to the field so screen readers read it with the input.
  • Mark the field with aria-invalid="true" while it holds an error.
  • Move focus to the first field with an error after a failed send, so keyboard users do not have to hunt for it.
  • Keep what people typed. Clearing the form after an error is the fastest way to lose someone.

The Formpik script does these three things for you when the endpoint refuses answers: it writes each message under its field, sets aria-invalid and focuses the first field to fix. If you show messages in your own blocks, put them inside an element with data-formpik-error-for and the field key.

Keyboard and focus

  • Every control must work with the keyboard alone: Tab to reach it, Space or Enter to use it, arrow keys inside radio groups and selects.
  • Keep a visible focus style. Removing the outline without a replacement leaves keyboard users lost.
  • Prefer native controls. A real <select> or checkbox is accessible by default; a custom one has to rebuild all of that.

Hidden spam traps without traps for people

A honeypot field catches bots, but a badly hidden one can be read out to screen reader users who then fill it in. Hide it from everyone, with aria-hidden="true" on its wrapper and tabindex="-1" on the input, and give it a name people would not type into. Formpik's snippet uses the field _gotcha for this.

Success and status messages

When the form is sent, announce it. Put the success message in an element with role="status", or move focus to it, so people who cannot see the screen know it worked.

Test it

  1. Fill in the whole form using only the keyboard.
  2. Turn on your screen reader and listen to each field and error.
  3. Zoom the page to 200 percent and check that nothing overlaps.

References

Keep reading

More from the blog