Why this matters
Without labels, screen reader users hear 'edit text' with no context about what to type. Users with cognitive disabilities rely on visible labels to understand forms. Placeholder text is not a substitute — it disappears when typing begins and has low contrast by default.
Code examples
✗ Incorrect — fails WCAG
<input type="email" placeholder="Enter your email"> <input type="text" id="name" placeholder="Name">
✓ Correct — passes WCAG
<label for="email">Email address</label> <input type="email" id="email" placeholder="jane@example.com"> <label for="name">Full name</label> <input type="text" id="name">
How to fix it — step by step
- 1Add a <label> element for every form input
- 2Connect the label to the input using matching for= and id= attributes
- 3The for= value must exactly match the input's id= value
- 4Never use placeholder text as the only label — it disappears on focus
- 5If you need a visually hidden label, use a sr-only CSS class (position:absolute; clip:rect(0,0,0,0))
- 6For checkbox and radio groups, wrap them in a <fieldset> with a <legend>
- 7Test by clicking the label text — if the input doesn't focus, they're not connected
Reference: WCAG 2.2 Success Criterion 1.3.1 and 3.3.2 (Level A)
Test it for free
Use WebPossum to automatically detect this violation and every other WCAG 2.2 issue on your site. Free, instant, no signup required.