Skip to main content
Beta: Front-End Checklist is currently in beta. Some issues are still being fixed. Thanks for your patience.

Ensure all input fields have accessible names

Checks that input fields have accessible names so screen reader users know what data each field expects.

Utilities
Quick take
Typical fix time 10 min
  • Every `<input>`, `<textarea>`, and `<select>` must have a programmatically associated accessible name
  • Preferred: associate a `<label>` via matching `for`/`id` attributes
  • Alternatives: `aria-label` (inline string) or `aria-labelledby` (references another element's `id`)
  • Placeholder text is not an accessible name — it disappears on input and is not reliably announced
  • Applies to WCAG 2.1 SC 1.3.1 (Info and Relationships) and SC 4.1.2 (Name, Role, Value)
Why it matters: Screen readers announce the accessible name of a focused input before the user types. Without a name, VoiceOver reads 'text field' and NVDA reads 'edit' with no context, making it impossible for blind users to fill out forms correctly. Voice control users (Dragon NaturallySpeaking) also need the visible label text to match the accessible name so they can say 'click Email Address' to move focus to the field.

Rule Details

Form inputs must be clearly labeled so that users of assistive technology know what information they are expected to provide. WCAG 2.1 SC 4.1.2 (opens in new tab) and the accessible-name computation model both treat that name as required, which is why placeholders are not a substitute for a real label.

Code Example

<!-- ✅ Correct: <label> with matching for/id — most robust approach -->
<label for="email-address">Email Address</label>
<input type="email" id="email-address" name="email" autocomplete="email">
 
<!-- ✅ Correct: aria-label for a standalone search input -->
<input type="search" aria-label="Search the knowledge base" name="q">
 
<!-- ✅ Correct: aria-labelledby references visible heading -->
<h2 id="billing-heading">Billing Address</h2>
<input type="text" aria-labelledby="billing-heading" id="billing-street">
 
<!-- ❌ Incorrect: placeholder is NOT an accessible name -->
<input type="text" placeholder="Enter your name">
 
<!-- ❌ Incorrect: visually hidden label text without proper association -->
<span>Username</span>
<input type="text" name="username">

Why It Matters

  • Form Usability: Screen readers announce the name when focus moves to the field, giving users context before they type.
  • Voice Control: Dragon NaturallySpeaking users say "click [label text]" to activate fields — the accessible name must match visible text.
  • Error Recovery: When validation fails, the error message can reference the field name, which only works if the name was defined.
  • AT Navigation: Screen reader users jump between fields using Tab; the name is the only context they get.

Accessible Name Computation Order

The browser computes an input's accessible name using this priority order (highest wins):

  1. aria-labelledby — references another element's text
  2. aria-label — inline string on the element itself
  3. Associated <label> element (via for/id or wrapping)
  4. title attribute (last resort; also shows as tooltip)
  5. placeholdernot a reliable accessible name

Exceptions

  • Prefer native HTML semantics over ARIA when both are possible; some apparent ARIA failures disappear when the underlying element is corrected.
  • A missing ARIA attribute is not automatically the strongest finding if the control is already semantically broken, unnamed, or keyboard-inaccessible.
  • Do not add ARIA only to satisfy the rule if the feature should instead be implemented with a native element or a simpler interaction pattern.

Standards

  • Align the implementation with WCAG 2.1 SC 4.1.2: Name, Role, Value and verify the rendered experience, not only the source code.
  • Align the implementation with WCAG 2.1 SC 1.3.1: Info and Relationships and verify the rendered experience, not only the source code.
  • Align the implementation with WAI-ARIA 1.2: Accessible Name and Description Computation and verify the rendered experience, not only the source code.

Verification

Automated Checks

  • Inspect the browser accessibility tree or accessibility pane for the relevant element, role, or accessible name.
  • Run an automated accessibility checker such as axe or Lighthouse where applicable.

Manual Checks

  • Test the affected UI with keyboard-only navigation and confirm the rule holds in the rendered experience.
  • Re-test one representative user flow with a screen reader if this rule affects a key interaction.

Use with AI

Copy these prompts to use with your AI assistant, or install the MCP server to use directly from Claude, Cursor, or Windsurf.

Check

Verify implementation

Find all `<input>` (excluding type='hidden'), `<textarea>`, and `<select>` elements. For each, check that one of these is true: (1) a `<label>` element with a `for` attribute matching the input's `id` exists, (2) the input has a non-empty `aria-label` attribute, or (3) the input has an `aria-labelledby` attribute pointing to a visible element. Flag any that use only `placeholder` as their label. Also check custom widgets using role=textbox, role=combobox, etc.

Fix

Auto-fix issues

For each unlabeled input: (1) Add a `<label for='input-id'>Label text</label>` and matching `id` on the input — this is the most robust method. (2) If a visible label is impractical (e.g., search bar), add `aria-label='Search'` directly on the input. (3) If the label text already exists elsewhere in the DOM, add `aria-labelledby='label-element-id'` to the input. Remove `placeholder` as a substitute for a label; keep placeholder only as a hint for expected format.

Explain

Learn more

WCAG 2.1 SC 4.1.2 (Name, Role, Value) requires that all user interface components have an accessible name. For form inputs, the accessible name is computed from: (1) `aria-labelledby` → (2) `aria-label` → (3) associated `<label>` → (4) `title` attribute (last resort). Screen readers announce this name when the input receives focus. Without it, a blind user hears only the input type ('text field') with no indication of what to type. Dragon NaturallySpeaking users need the accessible name to match visible text so voice commands work.

Review

Code review

Review the rendered markup and interactive states that affect Ensure all input fields have accessible names. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.

Sources

References used to support the guidance in this rule.

Further Reading

Tools and supplementary material for exploring the topic in more depth.

axe DevTools
deque.comTool

Rules that often go hand-in-hand with this one.

Provide accessible names for tree items

All elements with role="treeitem" must have a descriptive accessible name so screen reader users can navigate hierarchical tree widgets.

Accessibility
Provide accessible names for ARIA command elements

Checks that command elements like buttons and links have accessible names for screen reader support.

Accessibility
Ensure dialogs have an accessible name

Checks that dialog elements have accessible names to orient screen reader users.

Accessibility
Provide accessible names for meter elements

Checks that meter elements have accessible names to provide context for measurements.

Accessibility

Was this rule helpful?

Your feedback helps improve rule quality. This stays internal for now.

Loading feedback...
0 / 385