Skip to content

Accessible forms in WordPress: labels, errors and required fields

Forms are where accessibility problems cost you leads and sales. A practical guide to labels, error messages, required fields and autocomplete.

A form with visible labels, a written error message and a focus ring on the send button

If a visitor cannot complete your contact form or checkout, nothing else on the site matters. Forms are also where small markup mistakes make a big difference to screen reader and keyboard users. Use this checklist on every form you publish.

1. Every field needs a label

  • Use a visible <label> linked to the input (with for and id, or by wrapping the input).
  • Placeholders are hints, not labels.
  • Group related options (radio buttons, checkboxes) in a fieldset with a legend.
  • Icon-only buttons need an accessible name, such as aria-label="Search".

2. Mark required fields properly

  • Say it in words: “(required)” or a line at the top, “Fields marked * are required”.
  • Add the required attribute so assistive tools know.
  • Do not rely on color alone to show required or invalid.

3. Write errors people can act on

  1. Name the field and the problem: “Email address: add an @ sign”.
  2. Show the message next to the field and link it with aria-describedby.
  3. Set aria-invalid="true" on the field.
  4. After a failed submit, move focus to an error summary or the first invalid field.
  5. Keep what the person already typed.

4. Help people fill in details

  • Use the right type (email, tel, number) so mobile keyboards adapt.
  • Add autocomplete values for name, email, phone and address (WCAG 1.3.5).
  • Do not ask for the same information twice in one process (WCAG 3.3.7).
  • Allow pasting in password fields (WCAG 3.3.8).

5. Keyboard and focus

  • Tab order follows the visual order.
  • The focused field has a clearly visible outline.
  • Enter submits, and custom widgets (date pickers, dropdowns) work without a mouse.
  • CAPTCHAs have a non-visual alternative.

6. Test it

  1. Complete the form with the keyboard only.
  2. Submit it empty and read the errors aloud. Do they make sense?
  3. Zoom to 200%; nothing should overlap.
  4. Run a scan to catch missing labels and names.

AccessIQ flags form fields with no label, buttons with no name and many related markup problems, and shows the element so you can fix the template. Page builders and form plugins vary a lot, so scan the real page, not only the form builder preview.

Next: The 10-minute keyboard test every WordPress site should pass and Multi-step lead forms in WordPress: how to build one that people finish.

Frequently asked questions

Is a placeholder enough as a label?

No. Placeholders disappear when typing, often have poor contrast, and are not reliably announced as labels. Use a real label element.

How should I show required fields?

Say it in text, such as (required) or a note that explains the asterisk, and also set the required attribute.

How should error messages work?

Describe the problem in words, place it next to the field, link it to the input and move focus to the first error or an error summary.

What is the autocomplete attribute for?

It lets browsers and assistive tools fill in common fields such as name, email and address, which helps people with motor or cognitive difficulties.

Leave a comment

Keep reading

Related articles

Accessibility

স্কিপ লিংক ও ল্যান্ডমার্ক: ১৫ মিনিটে ওয়ার্ডপ্রেস থিমের নেভিগেশন ঠিক করুন

একটি স্কিপ লিংক আর সঠিক ল্যান্ডমার্ক যোগ করলে কিবোর্ড ও স্ক্রিন রিডার ব্যবহারকারীর শত শত ট্যাব চাপ বাঁচে। কীভাবে যোগ ও পরীক্ষা করবেন, জেনে…

২ মিনিটে পড়া

Ready to build with us?

Pick a product and be live in minutes. Free plans available.

Find your product