Introduction

Form Labels Explained

View contents

Form Labels: Why Proper Labeling Matters for Accessibility

Introduction

Form labels are text descriptions that identify the purpose of form fields. They’re essential for accessibility because screen readers rely on properly associated labels to announce what information each field expects. WCAG 2.2 includes multiple success criteria related to labels, making them a critical accessibility requirement.

Without proper labels, users who can’t see the visual layout of your form won’t know what information to enter in each field—making your forms essentially unusable for them.

What Are Form Labels?

The HTML Label Element

Labels are connected to form inputs using the <label> element:

<!-- Method 1: Using for/id association -->
<label for="email">Email Address</label>
<input type="email" id="email" name="email">

<!-- Method 2: Wrapping the input -->
<label>
  Email Address
  <input type="email" name="email">
</label>

Types of Form Labeling

Method Use Case Example
<label> element Standard form fields Text inputs, selects, checkboxes
aria-label Visually hidden labels Search inputs, icon buttons
aria-labelledby Label from other elements Complex form groups
title attribute Last resort only Avoid when possible
Placeholder Not a label Should not replace labels

Why Labels Matter

Who Benefits

  1. Screen reader users - Labels are announced when focusing fields
  2. Users with motor disabilities - Clicking label activates the field
  3. Users with cognitive disabilities - Clear labels reduce confusion
  4. Everyone - Larger click targets improve usability

The Click Target Benefit

When labels are properly associated, clicking the label focuses the input:

<!-- Clicking "I agree to terms" checks the checkbox -->
<input type="checkbox" id="terms">
<label for="terms">I agree to the terms and conditions</label>

This increases the clickable area significantly—especially helpful for small checkboxes and radio buttons.

WCAG Requirements

Criterion Level Requirement
1.3.1 Info and Relationships A Labels must be programmatically associated
3.3.2 Labels or Instructions A Input fields must have labels or instructions
2.4.6 Headings and Labels AA Labels must be descriptive

Common Labeling Problems

1. Missing Labels

<!-- BAD: No label at all -->
<input type="text" name="username">

<!-- GOOD: Proper label association -->
<label for="username">Username</label>
<input type="text" id="username" name="username">

2. Placeholder as Label

<!-- BAD: Placeholder is not a label -->
<input type="email" placeholder="Enter your email">

<!-- GOOD: Label with optional placeholder -->
<label for="email">Email</label>
<input type="email" id="email" placeholder="[email protected]">

Why placeholders aren’t labels:

  • Disappear when user starts typing
  • Often have poor contrast
  • Not announced by all screen readers
  • Users may forget what the field is for

3. Labels Not Associated

<!-- BAD: Label exists but isn't connected -->
<label>Full Name</label>
<input type="text" id="name">

<!-- GOOD: for/id creates association -->
<label for="name">Full Name</label>
<input type="text" id="name">

4. Duplicate IDs

<!-- BAD: Both inputs have same ID -->
<label for="email">Work Email</label>
<input type="email" id="email">

<label for="email">Personal Email</label>
<input type="email" id="email">

<!-- GOOD: Unique IDs for each -->
<label for="work-email">Work Email</label>
<input type="email" id="work-email">

<label for="personal-email">Personal Email</label>
<input type="email" id="personal-email">

5. Hidden Labels Incorrectly

<!-- BAD: display:none hides from screen readers too -->
<label for="search" style="display: none;">Search</label>
<input type="search" id="search">

<!-- GOOD: Visually hidden but accessible -->
<label for="search" class="sr-only">Search</label>
<input type="search" id="search">

<style>
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
</style>

Testing Form Labels

Quick Manual Test

  1. Click on each label—does it focus the correct input?
  2. Tab through the form—does the screen reader announce each field’s purpose?
  3. Is every required field clearly marked?

Using Developer Tools

Chrome DevTools:
1. Inspect a form input
2. Check the Accessibility panel
3. Look for "Name" property
4. Verify it matches the visible label

Automated Tools

  • axe DevTools - Detects missing and improperly associated labels
  • WAVE - Highlights form fields without labels
  • Lighthouse - Reports label accessibility issues

Quick Fixes

Adding Labels to Existing Forms

<!-- Before: No labels -->
<input type="text" placeholder="Name">
<input type="email" placeholder="Email">
<button>Submit</button>

<!-- After: Proper labels -->
<div>
  <label for="name">Name</label>
  <input type="text" id="name" placeholder="John Doe">
</div>
<div>
  <label for="email">Email</label>
  <input type="email" id="email" placeholder="[email protected]">
</div>
<button type="submit">Submit</button>

Labeling Icon-Only Inputs

<!-- Search with icon button -->
<label for="search" class="sr-only">Search</label>
<input type="search" id="search">
<button type="submit" aria-label="Submit search">
  <svg aria-hidden="true"><!-- search icon --></svg>
</button>

Best Practices Summary

Do Don’t
Use <label> element with for/id Use placeholder as label
Make labels descriptive and concise Hide labels with display:none
Use unique IDs for each input Duplicate IDs on a page
Mark required fields clearly Rely on asterisks alone
Test with screen readers Assume visual proximity is enough

References

  1. W3C - WCAG 2.2 SC 1.3.1 Info and Relationships
  2. W3C - WCAG 2.2 SC 3.3.2 Labels or Instructions
  3. WebAIM - Creating Accessible Forms
  4. MDN - The Label Element

Related articles

Related version

Detailed guide

Form Labels Implementation Guide

This comprehensive guide covers advanced form labeling techniques for WCAG compliance

Category hub

Hub

Accessible Components Hub

Building accessible web components requires understanding both the visual and programmatic aspects of user interfaces

In the same category

Introduction

Color Contrast Explained

Color contrast is the difference in luminance between foreground (text) and background colors