# Check form labels

- Check 11.09 · Semantic HTML and accessibility · Important
- Source: https://checklist-seo-geo.com/en/semantic-html-accessibility/check-form-labels
- Associate a label element with every form field in HTML, WordPress, Shopify, Drupal, Laravel or Next.js, then check the accessible name of each field.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/semantic-html-accessibility/check-form-labels.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

Every form field (text, email, checkbox, drop-down list, search box) needs a label that says what is expected, tied to the field in the code by the `<label>` element. Once the task is done, every field has an accessible name that matches its visible label, screen readers announce it, clicking the label puts the cursor in the field, and an AI agent filling in the form knows what to type where.

## Why it matters

A browser computes an “accessible name” for every field: it is what screen readers, voice control software and automation tools read. That name comes first from an associated `<label>`, or failing that from ARIA (Accessible Rich Internet Applications) attributes such as `aria-labelledby` or `aria-label`. Text placed next to the field in a `<div>` or a `<span>` does not count: the field stays anonymous and the screen reader only announces “edit text”.

Placeholder text (`placeholder`) does not replace the label. It disappears as soon as you type, it often has low contrast, and browsers only use it as a name as a last resort.

The problem is widespread: in 2026, the annual [WebAIM Million](https://webaim.org/projects/million/) study found unlabeled fields on 51% of the home pages analyzed.

Forms are also where AI agents browsing on a user's behalf have to pass. Some automation tools drive the page from the accessibility tree rather than from screenshots; Microsoft's Playwright MCP server is one example. For these tools, a field without a name is a field whose purpose is unknown. No search engine documents any effect of labels on rankings.

## What it improves

- **Accessibility**: compliance with WCAG (Web Content Accessibility Guidelines) success criteria 1.3.1 “Info and Relationships”, 3.3.2 “Labels or Instructions”, 4.1.2 “Name, Role, Value” and 2.5.3 “Label in Name”.
- **Conversion**: the clickable area of checkboxes and radio buttons extends to the label, input errors go down, and browser autofill works better.
- **AI agents**: a browsing agent identifies fields and fills them in without guessing. A real effect, but hard to measure.
- **Rankings**: no documented direct effect.

## How to check

**Automated audit.** Run WAVE or axe DevTools on every page that contains a form: contact, quote request, search, newsletter, login, account creation, cart and checkout. WAVE reports “Missing form label”; axe and Lighthouse flag the `label` rule (“Form elements do not have associated labels”).

**Manual check.** Tools cannot spot a wrong or misleading label. In Chrome, right-click the field, choose Inspect, then open the Accessibility tab of the Elements panel: the “Name” line of the computed properties must contain the visible label. Then click each label: the cursor must land in the right field.

**Quick inventory in the console.** Paste this script into the browser console to list fields without a name:

```js
[...document.querySelectorAll('input:not([type=hidden]):not([type=submit]):not([type=button]), select, textarea')]
  .filter((el) => !el.labels?.length && !el.getAttribute('aria-labelledby') && !el.getAttribute('aria-label'))
  .forEach((el) => console.log(el.outerHTML));
```

No line printed: every field has a source for its name. You still need to check that this name matches the visible text.

## How to implement

### Before you start

Choose the technique in this order:

| Situation | Technique |
| --- | --- |
| General case | Visible `<label for="field-id">`, unique `id` on the field |
| No `id` possible (generated field) | Field placed inside the `<label>` |
| Group of radio buttons or checkboxes | `<fieldset>` and `<legend>` for the question, one `<label>` per option |
| Label already visible elsewhere (table caption, column header) | `aria-labelledby` pointing to the `id` of that text |
| Field with a justified lack of visible label (search with a “Search” button) | Visually hidden label, or `aria-label` |

Common rules:

- The accessible name **contains the visible label**, ideally at the start: a voice control user says “click Email”.
- **Format instructions** (“DD/MM/YYYY”, “at least 8 characters”) stay visible and are tied to the field with `aria-describedby`.
- **Required fields** are marked in the label (text or an explained asterisk) and with the `required` attribute.
- The **`autocomplete`** attribute (`name`, `email`, `tel`, `postal-code`…) on fields about the user meets success criterion 1.3.5 and helps autofill.

Complete template, ready to paste:

```html
<form action="/contact" method="post" novalidate>
  <p>Fields marked with an asterisk (*) are required.</p>

  <label for="nom">Name *</label>
  <input id="nom" name="nom" type="text" autocomplete="name" required>

  <label for="email">Email *</label>
  <input id="email" name="email" type="email" autocomplete="email" required aria-describedby="email-aide">
  <p id="email-aide">We only use it to reply to you.</p>

  <fieldset>
    <legend>You are *</legend>
    <input id="profil-part" name="profil" type="radio" value="particulier" required>
    <label for="profil-part">An individual</label>
    <input id="profil-pro" name="profil" type="radio" value="professionnel">
    <label for="profil-pro">A professional</label>
  </fieldset>

  <label for="message">Your message *</label>
  <textarea id="message" name="message" rows="6" required></textarea>

  <input id="rgpd" name="rgpd" type="checkbox" required>
  <label for="rgpd">I agree that my data will be used to handle my request *</label>

  <button type="submit">Send message</button>
</form>
```

For a search field whose label is not displayed, keep a label in the code, hidden with a “visually hidden” type of class, never with `display: none` or `visibility: hidden`, which also remove it from the accessibility tree:

```html
<form role="search" action="/recherche">
  <label for="q" class="visually-hidden">Search the site</label>
  <input id="q" name="q" type="search">
  <button type="submit">Search</button>
</form>
```

```css
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
```

When there is an error, tie the message to the field and mark the field as invalid. Message wording is covered in [provide clear error messages](https://checklist-seo-geo.com/en/ai-agent-compatibility/provide-clear-error-messages).

```html
<label for="cp">Postal code *</label>
<input id="cp" name="cp" type="text" inputmode="numeric" autocomplete="postal-code" aria-invalid="true" aria-describedby="cp-erreur">
<p id="cp-erreur">The postal code must have 5 digits, for example 69003.</p>
```

### WordPress

Versions: WordPress 6.4 and later (checked up to 7.1); Contact Form 7 5.5 and later (checked with 6.2).

- **Block editor**: the Search block has a configurable label; if you hide it from the block toolbar, check in the HTML that it is still present in visually hidden form. The core comment form produces correct labels; a theme that overrides it with `placeholder` alone must be fixed.
- **Contact Form 7**: the form-tag does not create a label. Wrap it in a `<label>` in the Form tab:

```txt
<label> Your name (required)
    [text* your-name autocomplete:name] </label>

<label> Your email (required)
    [email* your-email autocomplete:email] </label>

<label> Your message
    [textarea your-message] </label>

[submit "Send"]
```

- **Gravity Forms, WPForms and form builders**: fill in the label of every field, even if the design does not display one. Options that hide the label must keep it in the code for screen readers: check this with the script from the “How to check” section.
- **WooCommerce**: checkout fields have labels. Plugins that customize the checkout page and “minimalist” themes sometimes replace them with `placeholder`: test the full checkout.

### Shopify

Versions: Online Store 2.0 themes (Dawn and its derivatives), November 2026.

In Online Store 2.0 themes, the contact form lives in `sections/contact-form.liquid`. Tie each field to its label with unique `id` values:

```liquid
{% form 'contact', id: 'ContactForm' %}
  {% if form.posted_successfully? %}
    <p role="status">Thank you, your message has been sent.</p>
  {% endif %}

  <label for="ContactForm-name">Name</label>
  <input id="ContactForm-name" type="text" name="contact[Nom]" autocomplete="name" value="{{ form.name }}">

  <label for="ContactForm-email">Email *</label>
  <input id="ContactForm-email" type="email" name="contact[email]" autocomplete="email" required
    {% if form.errors contains 'email' %}aria-invalid="true" aria-describedby="ContactForm-email-error"{% endif %}>
  {% if form.errors contains 'email' %}
    <p id="ContactForm-email-error">{{ form.errors.translated_fields.email | capitalize }} {{ form.errors.messages.email }}</p>
  {% endif %}

  <label for="ContactForm-body">Message</label>
  <textarea id="ContactForm-body" name="contact[body]" rows="6">{{ form.body }}</textarea>

  <button type="submit">Send</button>
{% endform %}
```

The “floating” labels of some themes are acceptable as long as they remain associated `<label>` elements. Also check the newsletter signup in the footer and the search, often shipped with a `placeholder` alone, as well as fields added by apps.

### PrestaShop

Versions: PrestaShop 8 and 9 (Classic and Hummingbird themes).

The contact form lives in `themes/votre-theme/modules/contactform/views/templates/widget/contactform.tpl` (module override), at the same location in the Classic theme and in Hummingbird, the default theme for new installations since PrestaShop 9.1. Account and checkout fields go through `templates/_partials/form-fields.tpl`. Check that each `<label>` has a `for` equal to the field's `id`; in marketplace themes, the `id` is often what is missing. Clear the cache (`Advanced Parameters > Performance`) after making changes.

### Drupal

Versions: Drupal 10 and 11; Webform module 6.2 and 6.3.

The Form API generates the `<label>` from `#title`. Never remove the title: hide it if needed.

```php
$form['email'] = [
  '#type' => 'email',
  '#title' => $this->t('Email'),
  '#title_display' => 'invisible',
  '#required' => TRUE,
  '#attributes' => ['autocomplete' => 'email'],
];
```

`invisible` keeps the label for assistive technologies. With the Webform module, the equivalent setting is in the title display options of each element.

### Wix

Versions: Wix Editor and Wix Studio, Squarespace 7.1, Webflow Designer, November 2026.

In the Wix form editor, fill in the title of every field rather than just the placeholder text, and keep it visible whenever possible. The generated code cannot be edited: check the result with WAVE or axe DevTools on the published site. Squarespace and Webflow follow the same logic: one label per field in the form block panel. In Webflow, a Label element is tied to its field through the “For” setting in its settings.

### Laravel

Versions: Laravel 10 to 13, Livewire 3 and 4.

Create a Blade component that enforces the label and handles the error, in `resources/views/components/champ.blade.php`:

```blade
@props(['name', 'label', 'type' => 'text', 'autocomplete' => null, 'aide' => null])

@php
    $id = "champ-{$name}";
    $describedBy = collect([
        $aide ? "{$id}-aide" : null,
        $errors->has($name) ? "{$id}-erreur" : null,
    ])->filter()->implode(' ');
@endphp

<label for="{{ $id }}">{{ $label }}</label>
<input
    id="{{ $id }}"
    name="{{ $name }}"
    type="{{ $type }}"
    value="{{ old($name) }}"
    @if($autocomplete) autocomplete="{{ $autocomplete }}" @endif
    @if($describedBy) aria-describedby="{{ $describedBy }}" @endif
    @error($name) aria-invalid="true" @enderror
    {{ $attributes }}
>
@if($aide)
    <p id="{{ $id }}-aide">{{ $aide }}</p>
@endif
@error($name)
    <p id="{{ $id }}-erreur">{{ $message }}</p>
@enderror
```

Usage: `<x-champ name="email" label="Email *" type="email" autocomplete="email" required />`. With Livewire, add `wire:model` on the component; the `for`/`id` association stays the same.

### Symfony

Versions: Symfony 6.4, 7.4 and 8.x.

`form_row()` and `form_label()` produce a correct `<label for>`. Keep a label even when the design does not want one:

```php
$builder->add('q', SearchType::class, [
    'label' => 'Search the site',
    'label_attr' => ['class' => 'visually-hidden'],
]);
```

`'label' => false` removes the label: avoid it.

### Next.js

Versions: Next.js 15 and 16 (React 19).

In JSX, the attribute is written `htmlFor`. React's `useId()` hook produces unique identifiers, even when the component is repeated or rendered on the server:

```tsx
'use client';

import { useId } from 'react';

export function ChampEmail({ erreur }: { erreur?: string }) {
  const id = useId();
  const erreurId = `${id}-erreur`;

  return (
    <>
      <label htmlFor={id}>Email *</label>
      <input
        id={id}
        name="email"
        type="email"
        autoComplete="email"
        required
        aria-invalid={erreur ? true : undefined}
        aria-describedby={erreur ? erreurId : undefined}
      />
      {erreur && <p id={erreurId}>{erreur}</p>}
    </>
  );
}
```

The Next.js ESLint configuration installs `eslint-plugin-jsx-a11y` but only enables a few of its rules. Since Next.js 16, `next lint` no longer exists: add the `label-has-associated-control` rule in `eslint.config.mjs`, then run `npx eslint .` to detect orphan labels.

```js
import { defineConfig } from 'eslint/config';
import nextVitals from 'eslint-config-next/core-web-vitals';

export default defineConfig([
  ...nextVitals,
  {
    rules: {
      'jsx-a11y/label-has-associated-control': 'error',
    },
  },
]);
```

Component libraries (Material UI, Chakra, shadcn/ui) tie the label to the field if you fill in their `label` prop: do not leave it empty. With Vue and Nuxt, bind `:for` and `:id` to the same value, for example one produced by `useId()` in Vue 3.5 and later.

## Common mistakes

- **`placeholder` as the only label**: it disappears on input and is not a reliable name.
- **`for` pointing to a missing or duplicated `id`**: common when a form appears twice on the page (header and footer). Every `id` must be unique.
- **Label hidden with `display: none`**: it disappears for screen readers too. Use a visually hidden class.
- **`aria-label` different from the visible text**: “Send” on screen and `aria-label="Submit the form"` in the code break voice control.
- **Radio button groups without `<fieldset>`**: “Yes” and “No” are announced without the question.
- **Fields added by JavaScript** (captcha, date picker, address autocomplete): they often escape the theme's control. Test the form once it has fully loaded.
- **Submit button reduced to an icon** with no text and no `aria-label`: see [distinguish action buttons from navigation links](https://checklist-seo-geo.com/en/semantic-html-accessibility/distinguish-action-buttons-from-navigation-links).

## Frequently asked questions

### Can a placeholder replace a field's label?

No, a placeholder does not replace a label element. It disappears as soon as the user starts typing, so the instruction is lost during input; it often has low contrast, and browsers only use it as the accessible name as a last resort. Keep a visible label tied to the field, and reserve the placeholder for an optional format example.

### Should a form field use aria-label or label?

Prefer the label element associated through for and id: it is visible, clickable and understood by every browser and assistive technology. Reserve aria-label for the rare fields whose purpose is obvious without a visible label, such as a search box with a Search button. When the label text already exists on screen, aria-labelledby pointing to that text is better than a separately written aria-label.

### Do form labels affect SEO?

No search engine documents any effect of form labels on rankings. Their value lies elsewhere: compliance with WCAG success criteria, forms that work with a screen reader or voice control, fewer input errors and better conversion. They also help AI agents that fill in forms from the accessibility tree, because a field without a name does not tell them what to enter.

### Can a field's label be visually hidden?

Yes, if the context makes the field's purpose obvious, for example a search bar with a Search button. Hide the label with a visually hidden class that keeps it in the code, never with display none or visibility hidden, which also remove it from the accessibility tree. For contact, quote request or checkout forms, keep labels visible.

## Resources

- [W3C WAI: Labeling Controls](https://www.w3.org/WAI/tutorials/forms/labels/)
- [W3C: Understanding Success Criterion 2.5.3, Label in Name](https://www.w3.org/WAI/WCAG22/Understanding/label-in-name.html)
- [MDN: the label element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/label)
- [MDN: the autocomplete attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete)
- [Chrome for Developers: Accessibility features reference for DevTools](https://developer.chrome.com/docs/devtools/accessibility/reference)
- [Next.js: Accessibility](https://nextjs.org/docs/architecture/accessibility)
- [WebAIM Million](https://webaim.org/projects/million/)

Next steps: [use ARIA when necessary](https://checklist-seo-geo.com/en/semantic-html-accessibility/use-aria-when-necessary), [test keyboard navigation](https://checklist-seo-geo.com/en/semantic-html-accessibility/test-keyboard-navigation) and [use semantic HTML and explicit labels](https://checklist-seo-geo.com/en/ai-agent-compatibility/use-semantic-html-explicit-labels).
