# Use semantic HTML and explicit labels

- Check 40.01 · AI agent compatibility · Experimental
- Source: https://checklist-seo-geo.com/en/ai-agent-compatibility/use-semantic-html-explicit-labels
- Structure pages and forms with native HTML and explicit labels so an AI agent understands and completes your journeys, then check the accessibility tree.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/ai-agent-compatibility/use-semantic-html-explicit-labels.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

An AI agent browsing on a user's behalf needs to understand what each area of the page is and what each field is for. Semantic HTML (`header`, `nav`, `main`, `h1` to `h6`, `button`, `label`, `fieldset`) and explicit labels give it that map without any guesswork. Once this check is done, the accessibility tree of your key pages faithfully describes their structure, and every field and every control carries a name that says what it does. This topic is experimental: agents evolve quickly and none of them publishes any guarantee about how it reads a page.

## Why it matters

Browsing agents read a page in three ways, often combined:

| Reading mode | What the agent receives | Documented example |
| --- | --- | --- |
| Accessibility tree | roles, names and states of elements, computed by the browser | Microsoft's Playwright MCP, which states that it uses the accessibility tree rather than pixel-based input |
| Screenshot | an image, then clicks at coordinates | Anthropic's *computer use* tool, ChatGPT agent's visual browser |
| Page text | the content converted to text | ChatGPT agent's text browser |

In all three cases, native HTML helps. The accessibility tree is built from HTML elements: a clickable `<div>` only appears in it as an unnamed generic container, whereas a `<button>` appears as a “button” with its label. Text placed next to a field in a `<span>` does not give it a name; a `<label for>` does. On a screenshot, the visible label is what counts: a field whose only hint is a `placeholder` that disappears on input loses its meaning as soon as it is filled in.

This is the same work as accessibility for screen readers. WCAG (Web Content Accessibility Guidelines) success criteria 1.3.1 “Info and Relationships”, 2.4.6 “Headings and Labels”, 3.3.2 “Labels or Instructions” and 4.1.2 “Name, Role, Value” describe exactly what an agent needs.

## What it improves

- **Agent success rate**: fewer field errors, fewer clicks in the wrong place. A plausible effect, consistent with the tools' documentation, but no vendor publishes any measurement.
- **Accessibility**: WCAG compliance, and compliance with the French RGAA (Référentiel général d'amélioration de l'accessibilité) on the same criteria. Online stores in the European Union have been bound by the European Accessibility Act since June 2025, depending on their size.
- **Conversion**: clearer forms, more reliable browser autofill.
- **Understanding by search engines**: well-marked-up headings and areas help split the content into sections. An indirect effect.
- **Rankings**: no documented direct effect.

## How to check

**1. Read the accessibility tree in Chrome.** Open a key page (product page, quote form, checkout flow), then DevTools, the Elements panel, the Accessibility tab (sometimes tucked behind the button for more tabs). Tick “Enable full-page accessibility tree”: the accessibility tree of the whole page replaces the DOM tree, and you see the page as the tools that rely on this tree see it. Look for clickable `generic` entries, `textbox` entries without a name and buttons named only “button”.

**2. Export the tree with Playwright.** To compare pages and keep a record, install Playwright (`npm i -D playwright` then `npx playwright install chromium`) and create `instantane-aria.mjs`:

```js
import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto(process.argv[2], { waitUntil: 'networkidle' });
console.log(await page.locator('body').ariaSnapshot());
await browser.close();
```

```bash
node instantane-aria.mjs https://example.com/devis
```

Compliant result, abridged:

```yaml
- banner:
  - link "Example, back to home"
  - navigation "Main menu":
    - link "Pricing"
- main:
  - heading "Request a quote" [level=1]
  - textbox "Company name"
  - textbox "Work email"
  - combobox "Number of employees"
  - button "Send quote request"
```

Warning signs: a `textbox` with no text in quotes, a `button` without a name, `generic` or `paragraph` where there should be a `button` or a `link`, no `main` or `heading`.

**3. Automated audit.** WAVE, axe DevTools or Lighthouse flag fields without a label, buttons without a name and skipped heading levels. See [test with axe, WAVE or Lighthouse](https://checklist-seo-geo.com/en/semantic-html-accessibility/test-axe-wave-lighthouse).

## How to implement

### Before you start

Prioritize the pages where an agent takes action: search, filters, product page, cart, checkout, booking, contact or quote form, sign-in. Then apply these mappings:

| Need | Native HTML | Avoid |
| --- | --- | --- |
| Page areas | `header`, `nav` with `aria-label`, a single `main`, `footer` | `div` elements with classes only |
| Hierarchy | one `h1`, then `h2`, `h3` without skipping levels | bold text styled as a heading |
| Action | `<button type="button">` or `type="submit"` | `<div onclick>`, `<a href="#">` |
| Navigation | `<a href="/page">` | a button that changes page in JavaScript |
| Field | `<label for>` + `id`, a suitable `autocomplete` | `placeholder` alone |
| Group of choices | `<fieldset>` + `<legend>` | a question in a `<p>` |
| Closed list of choices | `<select>` or radio buttons | a drop-down list made of `div` elements |
| Tabular data | `<table>`, `<th scope>` | a grid of `div` elements |

Labeling rules:

- **The visible label and the accessible name match**: if the button reads “Book”, its name starts with “Book” (criterion 2.5.3).
- **The label states the expected data, not just the category**: “Arrival date” rather than “Date”, “Work email” rather than “Contact”.
- **Format instructions are visible** and linked with `aria-describedby`: “DD/MM/YYYY”, “10 digits, no spaces”.
- **Input types are correct**: `type="email"`, `type="tel"`, `type="date"`, `type="number"`, `inputmode="numeric"`. They tell the agent which format is expected.
- **ARIA as a last resort**: a native element is better than an added role. See [use ARIA when necessary](https://checklist-seo-geo.com/en/semantic-html-accessibility/use-aria-when-necessary).

Booking form template, ready to paste:

```html
<main>
  <h1>Book a table</h1>
  <form action="/reservations" method="post">
    <label for="date">Date</label>
    <input id="date" name="date" type="date" required>

    <label for="heure">Arrival time</label>
    <select id="heure" name="heure" required>
      <option value="">Choose a time</option>
      <option value="19:00">19:00</option>
      <option value="19:30">19:30</option>
    </select>

    <label for="couverts">Number of guests</label>
    <input id="couverts" name="couverts" type="number" min="1" max="12" value="2" required>

    <fieldset>
      <legend>Seating</legend>
      <input id="salle" name="placement" type="radio" value="salle" checked>
      <label for="salle">Indoors</label>
      <input id="terrasse" name="placement" type="radio" value="terrasse">
      <label for="terrasse">On the terrace</label>
    </fieldset>

    <label for="tel">Mobile phone</label>
    <input id="tel" name="tel" type="tel" autocomplete="tel" aria-describedby="tel-aide" required>
    <p id="tel-aide">To confirm your booking by text message.</p>

    <button type="submit">Confirm booking</button>
  </form>
</main>
```

Form labels are covered in detail in [check form labels](https://checklist-seo-geo.com/en/semantic-html-accessibility/check-form-labels), and page areas in [use header, main, nav, article and footer appropriately](https://checklist-seo-geo.com/en/semantic-html-accessibility/use-header-main-nav-article-footer-appropriately).

### WordPress

Versions: WordPress 6.5 and later, block editor, WooCommerce 9 and 10, November 2026.

- **Theme**: recent block themes output `header`, `main` and `footer` through template parts. In the Site Editor (`Appearance > Editor`), select each Group and check under `Advanced > HTML element` that it uses the right tag.
- **Headings**: in Heading blocks, keep the levels in order; the editor's “Outline” view (Document Overview, list icon at the top left) flags skipped levels.
- **Forms**: with Contact Form 7, write the label around the field so that it is associated with it:

```txt
<label>Work email
    [email* email-pro]</label>
```

  With Gravity Forms, WPForms or Fluent Forms, keep the visible label enabled and do not use the “placeholder instead of label” option.
- **WooCommerce**: the Cart and Checkout blocks output labeled fields. If you add fields with an extension, check each one in the accessibility tree.
- **Page builders**: a “clickable box” widget often outputs a `div`; prefer a Button or Link widget.

### Shopify

Versions: Online Store 2.0 themes, Liquid, November 2026.

Recent Shopify themes output labeled forms. In a custom section, reuse this template and translate the labels through the theme's locale files:

```liquid
{% form 'contact', id: 'ContactDevis' %}
  <label for="ContactDevis-email">{{ 'templates.contact.form.email' | t }}</label>
  <input id="ContactDevis-email" type="email" name="contact[email]" autocomplete="email" required>

  <label for="ContactDevis-societe">Company name</label>
  <input id="ContactDevis-societe" type="text" name="contact[Société]" autocomplete="organization">

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

The checkout is managed by Shopify and cannot be modified in the theme: focus on product, collection, cart and contact pages.

### Webflow

Versions: Webflow Designer, November 2026.

- In the `Settings` panel of a Div Block, choose the tag (`Header`, `Nav`, `Main`, `Section`, `Footer`) rather than keeping `Div`.
- Form Block elements output a `Field Label` linked to the field: do not delete it to keep only the placeholder text.
- Webflow's Button element is a link: reserve it for navigation.

### Laravel

Versions: Laravel 11 to 13.

Centralize the markup in a Blade component that enforces the label:

```php
{{-- resources/views/components/champ.blade.php --}}
@props(['name', 'label', 'type' => 'text', 'aide' => null])

<div>
    <label for="{{ $name }}">{{ $label }}</label>
    <input
        id="{{ $name }}"
        name="{{ $name }}"
        type="{{ $type }}"
        value="{{ old($name) }}"
        @if($aide) aria-describedby="{{ $name }}-aide" @endif
        {{ $attributes }}
    >
    @if($aide)
        <p id="{{ $name }}-aide">{{ $aide }}</p>
    @endif
</div>
```

```php
<x-champ name="email" label="Work email" type="email" autocomplete="email" required />
```

A component without a `label` parameter cannot be called: the label becomes mandatory by design.

### Next.js

Versions: Next.js 15 and 16 (App Router).

Do the same with a React component that requires a label, and use `useId` for unique identifiers:

```tsx
import { useId, type InputHTMLAttributes } from 'react';

type ChampProps = InputHTMLAttributes<HTMLInputElement> & { label: string; aide?: string };

export function Champ({ label, aide, ...props }: ChampProps) {
  const id = useId();
  const aideId = `${id}-aide`;

  return (
    <div>
      <label htmlFor={id}>{label}</label>
      <input id={id} aria-describedby={aide ? aideId : undefined} {...props} />
      {aide && <p id={aideId}>{aide}</p>}
    </div>
  );
}
```

Component libraries (Radix, React Aria, Headless UI) produce a correct accessibility tree if you fill in their label properties; check it with the script from the “How to check” section.

## Common mistakes

- **A placeholder used as a label**: the field no longer has a visible name once filled in, and its accessible name depends on the browser.
- **A label hidden with `display: none`**: it also disappears from the accessibility tree. Use a “visually hidden” class.
- **Generic labels**: “Submit”, “OK”, “Field 1”. An agent does not know what it is submitting.
- **Duplicate `id` attributes** when a form appears twice on the page (header and footer): the `label for` points to the wrong field.
- **“All-div” components** imported from an old library: drop-down lists, tabs or checkboxes that have neither role nor state.
- **Fixing things for one specific agent**: adding made-up attributes or text reserved for bots. Correct HTML serves every agent and every human; different content for bots amounts to cloaking.

## Frequently asked questions

### Do AI agents really read the accessibility tree?

Some do. Playwright MCP, the Microsoft server that several assistants use to drive a browser, states that it relies on the accessibility tree rather than pixel-based clicks. Other agents work on screenshots or on the page text. Well-labeled native HTML serves all three modes: it produces a readable tree and labels that are visible on screen.

### Does semantic HTML improve SEO?

Not directly: Google documents no ranking boost for semantic tags or form labels. The effect is indirect. A clear heading hierarchy helps search engines and generative systems split and understand the content, and readable forms improve conversion and accessibility. The main benefit of this check is that agents and humans can actually use your journeys.

### Should you add special attributes for AI agents?

No, not at this stage. Standard HTML attributes (label, type, autocomplete, required) and, when necessary, documented ARIA attributes are enough. Proposals such as WebMCP, which would let you declare tools in forms, are still experimental and limited to trial programs. Start with correct HTML: it is the foundation any future standard will build on.

### Is a placeholder enough as a field label?

No. Placeholder text disappears as soon as the field is filled in, it often has low contrast, and browsers only use it as an accessible name as a last resort. An agent that reviews the form on a screenshot before submitting it no longer knows what each field contains. Keep a visible label and reserve the placeholder for a format example.

## Resources

- [MDN: accessibility tree](https://developer.mozilla.org/en-US/docs/Glossary/Accessibility_tree)
- [MDN: the label element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/label)
- [W3C: Understanding Success Criterion 4.1.2, Name, Role, Value](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html)
- [W3C: Understanding Success Criterion 3.3.2, Labels or Instructions](https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions.html)
- [Chrome for Developers: accessibility features reference](https://developer.chrome.com/docs/devtools/accessibility/reference)
- [Playwright: ARIA snapshots](https://playwright.dev/docs/aria-snapshots)
- [Microsoft: Playwright MCP](https://github.com/microsoft/playwright-mcp)
- [RGAA 4.1 (French accessibility framework): criteria and tests](https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/)

Next steps: [identify what each button does](https://checklist-seo-geo.com/en/ai-agent-compatibility/identify-what-each-button-does), [make component states accessible](https://checklist-seo-geo.com/en/ai-agent-compatibility/make-component-states-accessible) and [test user journeys with browsing agents](https://checklist-seo-geo.com/en/ai-agent-compatibility/test-user-journeys-browsing-agents).
