Fix Missing or Unassociated Form Labels
Learn how to properly label form fields for accessibility. Includes HTML, React, WordPress, and Shopify code examples.
What Is It?
A form label is text associated with an input field that describes what the input is for. Labels must be programmatically connected to inputs using the <label> element with a matching 'for' attribute.
Affected users: Screen reader users, voice control users, motor disability users, cognitive disability users, everyone on mobile devices with small screens
Why It Matters
Screen reader users cannot see input fields, so they rely on labels to understand what each field expects. Without labels, users can't navigate forms effectively. Properly labeled forms also reduce errors.
How to Detect This Issue
Inspect form fields and check if each <input>, <textarea>, or <select> has a corresponding <label> with matching 'for' and 'id' attributes. Test with a screen reader.
Code Examples & Fixes
HTML / CSS
<input type="email" placeholder="Enter your email"> <input type="password" placeholder="Enter your password"><label for="email">Email Address</label> <input type="email" id="email" name="email"> <label for="password">Password</label> <input type="password" id="password" name="password">The 'for' attribute on <label> must match the 'id' on <input>. This creates a programmatic association that screen readers understand.
React / Next.js
<input type="text" placeholder="Full name" /><label htmlFor="fullName">Full Name</label> <input type="text" id="fullName" name="fullName" />In React, use htmlFor instead of for. Make sure id, htmlFor, and name are consistent. Consider using controlled inputs with proper labeling.
WordPress
Contact form with text fields but no visible labels, only placeholdersContact form with proper <label> elements associated to each input field via id and for attributesIn WordPress form plugins like WPForms or Gravity Forms, enable 'Display Label' option. Avoid relying only on placeholders for labels.
Shopify Liquid
<input type="email" placeholder="Email"> <input type="password" placeholder="Password"><label for="email-input">Email</label> <input type="email" id="email-input"> <label for="password-input">Password</label> <input type="password" id="password-input">Edit Shopify liquid templates to add proper label elements. Ensure form field IDs are unique across the page.
Common Mistakes
Using only placeholder text instead of labels (placeholders disappear when user types)
Label text exists but isn't associated with input using 'for' and 'id' attributes
Using the same 'id' for multiple inputs on the same page (IDs must be unique)
Forgetting to add labels to required fields
Using labels visually hidden with display: none (should use sr-only class instead)
Frequently Asked Questions
Can I use placeholder text instead of labels?
What if my design doesn't have room for visible labels?
Do I need labels for every input?
How do I label grouped inputs like radio buttons or checkboxes?
Check your website for free
Get your ADA, WCAG, privacy & security score in 90 seconds.
Related guides
Identify and Explain Form Errors
Learn how to provide clear, accessible error messages and validation feedback. Includes code examples and best practices.
Identify Input Purpose Programmatically
Learn how to use autocomplete attributes to identify form field purpose. Helps browser fill forms automatically.