learn.web Back to the curriculum ↗

WCAG 2.2 / Inclusive Design / 02

Semantic structure and names

Create a reliable accessibility tree with native HTML, useful labels, and disciplined ARIA.

Time
75 min
Mode
Learn → Make → Check
Path
Accessibility

By the end, you can…

Assistive technology receives a model

Browsers transform DOM and CSS into an accessibility tree containing roles, names, states, and relationships. A visually clear control can be silent or misleading if that model is wrong.

Native HTML supplies semantics automatically. Labels connect instructions to form controls. Headings create navigable structure. Landmarks divide regions. ARIA can add missing information, but a role does not add keyboard behavior.

Name things by their purpose

An accessible name should distinguish the control in context: “Remove Maya from project” is more useful than six buttons named “Remove.” Visible text should normally be part of the accessible name.

Inspect the tree, then navigate by headings and landmarks with a screen reader. Fix the DOM model rather than hiding symptoms with extra announcements.

Working example
<label for="email">Work email</label>
<input id="email" name="email" type="email"
       autocomplete="email" required>

Your studio task

Make — Inspect and repair the accessibility tree of a real page.

  1. Open the accessibility tree for one page.
  2. Check landmark, heading, control name, role, state, and relationship.
  3. Replace avoidable ARIA with native HTML.
  4. Navigate the result by headings, landmarks, and form controls.
Definition of done

Landmarks, headings, control names, relationships, and reading order match the visible experience.

Open the interactive lesson with its workspace ↗

Knowledge check

What does role="button" add to a div by itself?
  1. Button semantics only
  2. Full keyboard and form behavior
  3. Automatic focus and Space-key handling
Reveal answer (A)

ARIA changes the exposed role; the author must still implement focus, keyboard behavior, and state.

An input's accessible name should normally…
  1. Include its visible label text
  2. Be hidden from all users
  3. Match its placeholder exactly
Reveal answer (A)

A visible label is the most reliable source of an accessible name.