GUIDE 2 OF 11 · WEBSITE HEALTH CHECK
Image alt text, form labels and link names
Three checks ask one question: can a person who cannot see the page tell what each picture, field and button is? Images need an alt attribute, form fields need a label, and links and buttons need a name. Each one is fixed by adding a short piece of text, not by redesigning anything.
AT A GLANCE
- Images: a warning if some have no
alt, a fail if more than 30% of them lack it (3 of 10 is a warning, 4 of 10 fails).alt=""counts as present. - Form fields: one field with no label is enough to fail. A placeholder is not a label.
- Links and buttons: a link or button with no text, no
aria-labeland no image alt gets a warning. This check never fails. - A page with no images, no form fields or no links skips that check, so it counts neither for nor against you.
| Check | Group | Points |
|---|---|---|
Images have alt text a11y-img-alt | Accessibility | 4 |
Form fields have labels a11y-form-labels | Accessibility | 4 |
Links and buttons have names a11y-link-names | Accessibility | 3 |
What each check looks at
| Check | What counts | Result |
|---|---|---|
Images have alt text (a11y-img-alt) | Every <img> needs an alt attribute. alt="" is fine for a decorative picture. An image with role="presentation" or aria-hidden="true" is left out. CSS background images, inline SVG and <input type="image"> are not looked at. | Warning when 30% or fewer of the images lack it, fail above that. No images: skipped. |
Form fields have labels (a11y-form-labels) | Every <input>, <select> and <textarea> (hidden, submit, button, reset and image inputs excepted) needs a <label for> that matches its id, or to sit inside a <label>, or to carry aria-label, aria-labelledby or title. | Fail if any field has none of these. No fields: skipped. |
Links and buttons have names (a11y-link-names) | Every <a href> and <button> needs visible text, an aria-label or title, an aria-labelledby, an image inside it with an alt, or an SVG inside it with a <title> or aria-label. | Warning if any has no name. Never a fail. No links or buttons: skipped. |
How to fix images
Describe what the picture shows or means in the place where it is used, not its file name. "Bar chart: sign-ups doubled in March" helps a person who cannot see the chart. "chart.png" does not. If a picture adds nothing, because it is decoration or the text beside it says the same, give it an empty alt so a screen reader skips it.
<img src="/team.jpg" alt="Two people reviewing a test report at a desk">
<img src="/divider.svg" alt="">A missing alt is not the same as an empty one. With no alt at all, a screen reader may read out the file name instead. That is why the checker counts alt="" as present and a missing attribute as a problem.
How to fix form labels
A label tells a screen reader user what to type. It also makes the label text clickable, which helps everyone on a phone. Placeholder text is not a label: it disappears when someone starts typing, and the checker does not count it.
<label for="email">Email address</label>
<input id="email" name="email" type="email">
<label>Phone number <input name="phone" type="tel"></label>If a design has no room for a visible label, aria-label on the field is accepted by the checker and by screen readers. A visible label is still better for everyone.
How to fix links and buttons with no name
The usual cause is an icon button: a magnifying glass, a menu or a close cross with no text. Give it a name that says what it does, not what it looks like.
<button type="button" aria-label="Close menu">
<svg aria-hidden="true" width="16" height="16" viewBox="0 0 16 16"><path d="M2 2l12 12M14 2L2 14" stroke="currentColor"/></svg>
</button>Links that only say "click here" or "read more" do have a name, so they pass this check. They are still poor for someone who moves through a page by listing its links, because every link sounds the same. Write the destination in the link text.
What these checks cannot see
They look at attributes, not meaning: alt="image" passes, and so does a label that says "Field 1". aria-labelledby only has to be present, so a pointer to an id that does not exist still passes. Only the HTML the server sends is read, so a form or image added later by JavaScript is not seen. And passing all of them does not make a page accessible: that needs people using a keyboard and a screen reader. The scanner's own description says so.
Questions people ask
Should every image have alt text?
Every image needs the alt attribute. The text can be empty (alt="") when the picture is only decoration. A picture that carries information, such as a chart, a product photo or an icon that acts as a button, needs a real description.
Why is a placeholder not enough as a label?
A placeholder disappears as soon as someone types, so it cannot tell them what the field was for. The W3C form tutorial says placeholder text is not a replacement for labels, and the checker follows that: placeholder text does not count.
Does one image without alt text fail the check?
No. One missing alt out of ten images is a warning. The check fails when more than 30% of the images have none: 4 of 10 fails, 3 of 10 is still a warning.
Where the facts come from
See also on this site
FREE · ABOUT TEN SECONDS · NOTHING STORED
Check your own site
Paste a web address into the free website health check. It runs the 36 checks these guides explain, gives a score out of 100, and says what to fix first.
Open the free website health check