Form Field Labels With a For Attribute That Does Not Match a Field ID

Form Field Labels With a For Attribute That Does Not Match a Field ID

WCAG Focus: WCAG 1.3.1 (A), 4.1.2 (A)

When a template developer edits an input’s id="billing_email" without updating the matching <label for="email">, the label sits right above the field visually yet has zero programmatic connection. Clicking the label no longer focuses the input, and screen readers fail to read the label when tabbing into the box.

Why This Pattern Violates WCAG

WCAG 1.3.1 Info and Relationships (Level A) and 4.1.2 Name, Role, Value (Level A) require the label’s for attribute to match the exact id of its associated form control.

Code Comparison

Inaccessible Mismatched For & ID

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

Compliant Matching For & ID

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

How to Fix It in WordPress

  • Verify every <label for="…"> attribute matches an existing input, select, or textarea id on the same page.
  • Ensure checkboxes and radio inputs each have unique IDs matching their individual labels.

Finding This Issue Automatically

Typos between for and id attributes are invisible on screen yet completely break screen reader form navigation. The WP ADA Compliance Check plugin cross-checks every label’s for attribute against form IDs on the page and flags mismatches right away.

Subscribe

Subscribe to receive daily Web Accessibility - Did you know? articles in your inbox.

Cart Accessibility Tools
hide