How to fix form fields without a label
WCAG 1.3.1 Info and Relationships and 4.1.2 Name, Role, Value, level A. Rule label in axe-core.
What is wrong
A text field, checkbox or radio button has no label that assistive technology can read. A screen reader says "edit text" and nothing else. On shop sites this is often the newsletter field in the footer, the search box, the quantity field or a checkout field.
Who it blocks
Screen reader users, voice control users (who say the label to move to a field), and people with memory or attention difficulties.
How to fix it
The best fix is a visible label tied to the field:
<label for="newsletter-email">Email for our newsletter</label>
<input id="newsletter-email" type="email" name="email" autocomplete="email">
When the design has no room for visible text, for example a search box with a magnifier icon, an aria-label is the smallest change:
<input type="search" name="q" aria-label="Search the shop">
Common mistakes
- Using only a placeholder. It disappears as soon as typing starts, and is often too light to read.
- A label whose
forvalue does not match theidof the field, often after a theme update. - Two fields with the same
id, so one label points to the wrong field.
How the scan proposes a fix
The scan adds an aria-label built from the field's placeholder, name or id, runs the same rule on the fixed markup, and checks that no existing attribute changed. A visible label is still the better fix when you can change the template.
Check your own pages for free
Drag this button onto your bookmarks bar: Scan with accessaudit. Then open a page of your shop and click the bookmark: a score and the three main defects appear in a few seconds. The check runs in your browser: no content of your page leaves it, only the scanner is downloaded from this site. Try it on a demo shop.