Menu

1 / 5

Sanity images missing alt text: fix an accessibility audit fail

DEV Community: nextjs·Nayan Kyada·10 days ago
#PrQ2RD64
#devtonextjs#devto#dev#decorative#field
Long article (1257 words) — no AI summary yet.
Reading 0:00
15s threshold

An accessibility audit, a lawyer's letter, or a Lighthouse report has told you your Sanity-powered site has images with missing alt text. It is usually a bigger problem than a handful of pages, because the cause sits in the schema and the front-end component, not in what editors typed. This post covers how to find every gap, how to stop new ones, and what to ask a developer to do.

Why Sanity images end up with no alt text

A plain Sanity image field stores the asset reference and the hotspot and crop data. It does not store a description. If the original developer never added an alt field to the schema, editors had nowhere to write one.

There are three common situations I find on inherited sites:

The schema has no alt field at all, so every image renders with no description.

The schema has an alt field, but it is optional, so editors skip it under deadline.

The schema and content are fine, but the GROQ projection never fetches alt, or the React component never passes it to the image element.

The third…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.