Why is the placeholder attribute on an HTML input not an acceptable replacement for a <label> element?
answer
- a hint, not a name
- gone on the first keystroke
- review and correction lose all context
- announcement is only a fallback
- grey text reads as a filled value
basics
~20 sA placeholder vanishes as soon as the user types, so the field's meaning disappears exactly when it is needed for review and correction. It is a hint, not a name, and is not a dependable accessible name for the control.
solid answer
~50 s`placeholder` is a short hint about the expected value; it is not a name for the control, and the HTML specification says outright that it should not be used as an alternative to a label. Three practical failures. First, it disappears on the first keystroke, so a user who tabs back, gets interrupted, or reviews a filled form before submitting has no idea what any field was — worst for exactly the users who need the most support. Second, it is unreliable as an accessible name: whether it is announced at all, and whether it is announced as a name or as a hint, varies by browser and screen reader, so you are betting a required piece of information on a fallback. Third, a field showing greyed hint text reads as already filled to many users, so people skip it. Use a persistent `<label>`, and keep `placeholder` for a genuine format example alongside it, not instead of it.
code
html · 6 lines<!-- Anti-pattern: no label at all -->
<input type="text" name="dob" placeholder="Date of birth (MM/YYYY)">
<!-- Correct: persistent label names it, placeholder only shows the format -->
<label for="dob">Date of birth</label>
<input type="text" id="dob" name="dob" placeholder="MM/YYYY">go deeper
Be able to state the core failure without hesitating: the placeholder disappears once the user types, so the field ends up with nothing naming it. Know that a real label element is the fix.
Explain the mechanics — hint versus name, the fallback nature of placeholder announcement, and the review-and-correct moment where the missing name actually costs the user something.
Be ready to negotiate this with design: offer the alternatives that preserve the label element, and describe how you would find placeholder-only fields across an existing product rather than fixing them one ticket at a time.
Own the position that the accessible name is non-negotiable while its presentation is a design variable. Be able to write that as a standard your teams can apply without escalating each form to you.
## What placeholder is for `placeholder` takes a short hint about the *expected value* of a field — an example format, a sample entry. It is shown in the control while the control is empty, and it is removed the moment the control has a value. That is the whole feature. It was never a naming mechanism, and the HTML specification is explicit that the attribute should not be used as an alternative to a `<label>`. The pattern persists because it looks clean in a mock-up: one line of markup, no label row, a tidy grid of boxes. The failures show up later, on real users, with real data. ## Failure one: it disappears exactly when it is needed ```html <!-- Looks fine until someone types --> <input type="text" placeholder="Date of birth (MM/YYYY)"> ``` The hint is visible while the field is empty and gone once it is not. So the field is self-describing during the two seconds you do not need help, and anonymous for the rest of the form's life: when the user tabs back to check an entry, when they are interrupted and return, when they review everything before submitting, when a validation error sends them back to "fix the third box". This imposes a memory cost on everyone and a hard barrier on users with cognitive or memory impairments, and it makes correction — the most error-prone moment in any form — the moment with the least context. ## Failure two: it is an unreliable accessible name A label creates a defined association: this element names that control. A placeholder is a hint attribute, and whether assistive technology treats it as a name, as a description, or ignores it entirely varies across browser and screen-reader combinations. Even where something is announced, you have made a required piece of information depend on a fallback path rather than on the mechanism designed to carry it. Voice-control users are hit similarly: they speak the visible label to target a field, and once the user has typed there is no visible text to speak. ## Failure three: it reads as content Grey text inside a box looks like a filled-in value to a great many users. The observable consequence is skipped fields and "the form said it was already filled" support tickets. The low-contrast rendering that makes hint text look like a hint is also the rendering that makes it hard to read for anyone with reduced vision, and authors who fix the contrast make it look even more like a real value. There are two smaller effects worth knowing. Browser translation features handle visible element text more consistently than they handle placeholder strings, so a placeholder-only form can end up partly untranslated. And a placeholder cannot be clicked to focus the field the way label text can, so you lose the enlarged hit target as well. ## What to do instead Keep a persistent, visible `<label>` associated with every control, and use `placeholder` only for something a label should not say — a concrete example of the format: ```html <label for="dob">Date of birth</label> <input type="text" id="dob" name="dob" placeholder="MM/YYYY"> ``` Even here, be honest about the cost: that format example also disappears on the first keystroke. If the format is genuinely necessary to fill the field correctly, put it in persistent text near the control (or in the label itself) rather than in the placeholder. A float-label pattern — placeholder-looking text that animates up into a label position on focus — keeps a visible name after typing and is a real improvement over placeholder-only, but only when it is built from an actual `<label>` element rather than from a placeholder plus styling. The question to ask of any such design is simply: after the user has typed, is there still text on screen naming this field, and is that text a label element associated with the control? ## How to say this in an interview Lead with the mechanism, not the rule. "A placeholder is a hint about the value and it is removed when there is a value, so it cannot carry the field's identity — identity has to persist through typing, review, and error correction. It is also only a fallback for the accessible name, which makes announcement browser-dependent." That answer shows you know *why* the guidance exists, which is what separates it from having memorised a lint rule.
- Is there any legitimate use for placeholder on a labelled field?Yes — a concrete example of the expected format, such as `placeholder="MM/YYYY"` beside a "Date of birth" label. It supplements the name rather than replacing it. Remember it still vanishes on the first keystroke, so if the format is essential to filling the field correctly, put that text in persistent markup near the control instead.
- Does a floating-label design solve the problem?Only if the moving text is a real `<label>` element associated with the control. Then a visible name persists after typing and the association is genuine. If it is a placeholder plus CSS animation, nothing has changed: there is no label element, no click forwarding, and no dependable accessible name — it just looks like there is.
- A designer insists labels take too much vertical space. What do you propose?Keep the `<label>` element and change its presentation, not its existence: move it inline, shorten the text, or position it off-screen for fields whose purpose is unmistakable from context. Each keeps the accessible name and the click target. Deleting the label to reclaim pixels trades a layout preference for a field nobody can identify after typing.
saying these in an interview costs you the question
- Screen readers read the placeholder, so it counts as a label
- Labels are old-fashioned; placeholders are the modern pattern
- Users will remember what each box was for
- A placeholder can also mark a field as required
- Styling a placeholder to look like a label makes it one