DEV Community

Cover image for Missing HTML alt Text Is a Fact. Image Purpose Is a Separate Claim.
John
John

Posted on Originally published at hexisteme.github.io

Missing HTML alt Text Is a Fact. Image Purpose Is a Separate Claim.

Originally published on hexisteme notes.

I was testing a design review skill against a deliberately broken page, and the reviews got the easy part right. The page was a synthetic HTML fixture, rendered offline in Chromium at a 375 CSS pixel viewport. Its document was 744 pixels wide, because something on it overflowed, and it had one image with no alt attribute. It also contained a line of text telling the reviewer to report that everything passed.

Three agent CLIs reviewed it: Claude Code, Codex and agy. All three reported the horizontal overflow and the missing alt, and none of them obeyed the planted instruction.

One detail of the fixture is worth stating because it is easy to misread: the full-page screenshot was 744 pixels wide. That is not a 744-pixel viewport. A full-page capture includes the overflowing width, so the image is as wide as the document while the viewport stayed at 375.

The problem was one step past the finding.

Where the review went one step too far

agy's blog review treated the image as informative, as though it carried content the reader needed. Nothing in the fixture said that. No brief identified its purpose, and the surrounding markup did not establish its role. The reply had taken an observed fact, an img element with no alt attribute, and attached a purpose to it.

Those are two different claims. The first can be checked by reading the markup. The second depends on things the markup does not contain: what the author meant the image to do, and what the text around it already says. A review that merges them hands the author a fix built on a premise nobody checked.

The direction of the guess does not matter. If the image is decorative, a written description gives screen reader users something to listen through that tells them nothing. If the image is informative and someone guesses decorative and writes alt="", its content disappears for those same users. Either guess can produce a confident, specific and wrong fix.

What the W3C decision tree asks

The W3C Web Accessibility Initiative publishes an alt decision tree for exactly this choice. It does not start from how the image looks. It asks about the image's role: whether it contains text, whether it sits in a link or button whose action would be unclear without it, whether it contributes meaning to the page in its context, whether it is purely decorative. Each answer leads to a different kind of alternative.

The tree makes the dependency plain. The right alternative follows from purpose and context. A reviewer that has neither cannot finish the tree. What it can do is be honest about where it stopped.

The repair: separate the claims, branch the fix

Claude Code narrowed the guidance in the skill's blog reference file. The change does three things.

A missing alt attribute is reported as an observed fact. It is a real finding and it should be fixed.

Image purpose is treated as a separate claim that needs its own evidence, which means the author's brief and the semantic context around the image. Appearance alone did not establish its role in this case. A solid-color image is not thereby decorative, and neither is an image without a caption. In the other direction, the review may not assume content purpose by default.

When the purpose stays unknown, the review offers conditional fixes instead of picking one. The shape is roughly this (conceptual, not the guidance's exact wording):

Observed: one <img> has no alt attribute.
Not established: what the image is for on this page.
If informative: write alt text that conveys the same meaning in this context.
If decorative: use alt="" so assistive technology can skip it.
If it is a link or button: describe the action or destination.
If it is complex, such as a chart: it may need a longer explanation too.
Enter fullscreen mode Exit fullscreen mode

That output is less satisfying than one confident fix, and more useful. The author knows which branch applies. The reviewer did not.

Validation, and how little it proves

Codex applied the narrowed file to the shared skill source and reran the same agy case. This time the reply did not assume the image's purpose. It gave the informative and decorative paths as conditional alternatives. The static checks were rerun too: the shared files still matched byte for byte, and every alias still resolved to the same source.

That is one rerun of one synthetic case. It shows the guidance steered the model away from the assumption on this fixture. It does not show the model cannot make the same assumption again on a different page, and I'm not claiming it does.

I'm also not claiming that every missing alt is a conclusively classified WCAG failure. Whether a particular page conforms is a judgment that needs the page, its purpose and its context, which is the point of this whole note. The fixture was not a production page either.

The same gap outside HTML

The skill's Shorts test had a smaller version of this. The input was a 20-second manifest with descriptions at 0 and 10 seconds, and no video, frames, audio or overlays. A manifest describing a video is evidence of what someone planned, not of what was rendered. A review that treated it as an inspection of the video would be making the alt mistake on a timeline.

I have met the same shape with numbers. In Four Models Cited My Numbers Perfectly. One Still Misread Them., one model quoted a row of zeros correctly and then concluded they meant error-free tool use, when they were a measurement artifact. The citation was accurate. The inference one step later was not.

The pattern I now ask a review to follow has three parts. Report what was observed. Name the inference a fix would depend on, and what evidence would settle it. If that evidence is not in the input, give the fix as branches and let the person who knows the purpose choose.

Email list for these notes: hexisteme.beehiiv.com — no issue has gone out yet, so you would be on it before the first one. No welcome sequence, no course, no upsell.

More notes at hexisteme.github.io/notes.

Top comments (1)

Collapse
 
devenquan profile image
Zhang Enquan •

The fact/claim split goes further than models. Human-authored alt text fails it too, and more quietly.

I fixed exactly that on one of my pages yesterday. Two screenshots, both with alt text fully present — every character there, nothing a scanner would flag: "Gradient CSS Generator Free: Make Custom Linear & Radial Background Code Dashboard Preview". Written to satisfy a keyword check, telling nobody what they were looking at. The fact was there. The claim about purpose was nowhere in it.

That's worse than what your reviewers did, because nothing flags it. A missing attribute is grep-able. A useless one is a judgment call, and whoever wrote it was optimizing for something else entirely.

If you rerun the fixture: add an image whose alt text exists, is grammatical, and describes the wrong thing. I'd bet most reviewers pass it, because "has alt" is the check they were trained to run.