★ GenAI Summit™ Asia|12–13 Dec, Kuala Lumpur|For AI Agency® students|See details →|★ GenAI Summit™ Asia|12–13 Dec, Kuala Lumpur|For AI Agency® students|See details →|★ GenAI Summit™ Asia|12–13 Dec, Kuala Lumpur|For AI Agency® students|See details →|★ GenAI Summit™ Asia|12–13 Dec, Kuala Lumpur|For AI Agency® students|See details →|
Three editors review the same dog photo in a web page, a video preview and a mobile layout.
AI How-ToNovember 30, 20267 min read

How to Write AI Alt Text for the Same Image in Different Places

See how one carton image needed different alt text across five storefront placements. Copy the editor prompt and use the developer handoff check to preserve intentional empty alt values.

GenAI Editorial

AI alt text is easier to review when you can see what the image does on the page. In our storefront test, a template changed the result in 2 of 5 placements after the AI had supplied appropriate alternatives. Both errors came from the same line of code, and both pages still looked fine.

We reused one drawing of a brown carton sealed with blue tape. In packing instructions, the reader needs to know where the tape goes. On an order-tracking link, the shopper needs to know where a click goes. Inside a tracking link that already contains its label, the picture may need no words at all. Asking an image library for one permanent description leaves those decisions to whoever builds the page.

What did the AI see in the picture?

We drew the carton, rendered it to a 320-by-220 PNG and gave that file to Gemini 2.5 Flash. The first request asked for one concise alt attribute for a small shop’s media library. It returned “A brown cardboard box sealed with blue tape.” The image shows exactly that. The answer only becomes a problem when a template treats it as finished copy for every use.

In a second request, we sent the identical PNG with five short HTML snippets. Each came with a note from the fictional shop explaining why the image appeared there. For the packing instruction, the note said the diagram was the only place showing how far the tape extended. For the tracking link, we supplied the destination and the exact placement of the visible words. This was a test of what a model could do with an editor’s context. We did not expect it to infer the store’s intent from cardboard and tape.

We ran each final input once, using temperature zero, and kept the JSON responses. On November 30, 2026, we then rendered the five snippets in Chrome 158 and inspected the browser’s accessibility tree. That tree exposes elements such as images and links, their roles, and their accessible names. A link’s accessible name is the label the browser makes available to assistive technology for that link. It can differ from the description attached to an image inside it.

What should the same image say in five different places?

1. Packing instructions. The page said “Seal the carton as shown.” The contextual answer was “Cardboard box sealed with blue tape across the top and down one side.” The part after “tape” earns its place. Someone following the written instructions can now reproduce the step. If the paragraph already explained the tape route in full, reconsider what the image adds before repeating it.

2. A picture-only link. The carton was the only content of a link to the order tracker. With the library description, Chrome named the link “A brown cardboard box sealed with blue tape.” With the contextual alternative, the name was “Track your order.” A reviewer looking only at the image might reject the second answer because it never mentions the carton. A reviewer asking what the shopper can do with the link has a reason to accept it. W3C guidance on functional images

3. A picture and visible text inside one link. This version put the words “Track your order” inside the same link as the carton. Gemini returned an empty string for the image. The rendered link kept the name “Track your order”, and Chrome exposed no separate image node there. With the generic description restored, the link name became “A brown cardboard box sealed with blue tape. Track your order”. The packaging description now came first in the link’s name.

4. The same words just outside the link. We moved the text into a neighbouring span. Only the picture was clickable. This time Gemini returned “Track your order” for the image itself. It may look redundant to someone reading across the screen. The link ended before the visible label began: </a><span>Track your order</span>. Those adjacent words did not name the link. Remember this case when a designer sends a screenshot with an instruction to “omit alt because the label is right there.”

5. A returns-page decoration. The heading and paragraph already explained how to start a return. The carton was unlinked and conveyed no further instruction. An explicit empty alternative, alt="", removed the decorative image from the non-ignored image nodes we inspected. Deleting the attribute entirely produced a different result in Chrome: an exposed image with an empty name. W3C also notes that some screen readers may announce the filename when the attribute is missing. W3C guidance on decorative images

How can an approved empty alternative disappear before launch?

Look for code that substitutes a default whenever a value is empty. We tested the common JavaScript expression placementAlt || libraryAlt. For a nonempty placement label, it used the editor’s value. For an intentionally empty string, it silently substituted the box description.

The packing diagram and both picture-only links kept their intended text. The combined link acquired the extra carton description, and the returns decoration reappeared as a named image. Nothing about the generated answers had changed. Regenerating them would send two more empty strings into exactly the same fallback.

A content editor and a developer need to agree on two distinct states: reviewed and deliberately empty, and awaiting a decision. If your data model uses null for an undecided value and a string for a reviewed one, test for null or undefined explicitly. For example, placementAlt ?? libraryAlt preserves an empty string. That change fixes the substitution in this example. It still cannot tell you whether a generic library description is suitable for a new picture-only link. Give those unresolved links an editorial check before delivery.

Test the template through the route a real editor will use. Save the empty alternative in the CMS, reopen the entry, and inspect the rendered page. A field can display as blank after saving whether it contains an empty string, contains null or has disappeared altogether. Check the actual image attribute and the name of the containing link. The distinction matters at both stages.

Does text beside a picture ever name its link?

Yes, if the page explicitly associates that text with the link. We checked this separately. With the image alternative empty, a neighbouring span reading “Track your order” and no association between them, Chrome reported an empty link name. We then gave the span an ID and referenced it from the link with aria-labelledby. Chrome reported “Track your order”. The PNG, visible wording and image alternative stayed the same.

That gives an editor two reasonable paths. If the design calls for the label to be clickable, ask the developer to put the words and image inside one link, then keep the redundant image alternative empty. If the layout genuinely requires separate elements, have the developer check how the link gets its name. For a straightforward image-only link with no other naming mechanism, an action-oriented image alternative worked in our test. A screenshot by itself cannot distinguish these cases. W3C’s accessible naming guide

What should an editor give the model and check at handoff?

For each placement, record the page, the asset, what the reader needs to learn or do, the destination if it is clickable, and the words already on screen. Include the actual link markup or say that the structure is unknown. Keep the approved alternative and the reason beside the placement so an editor can revisit the decision if the layout changes. The W3C decision tree is a useful reference for images that carry text or information too complicated for one short description. W3C alt decision tree

Here is a prompt to adapt when receiving a batch of images from a client:

> Review this image at each placement in the attached page snippets. For each one, return the exact alt value, including an empty string where appropriate, and one sentence explaining the choice. If it is clickable, identify what gives the link its name. Describe details needed for the reader’s task. Flag any placement whose purpose, destination or surrounding markup you cannot establish.

For the final check, pick a normal placement and a difficult one. In this shop, that means the packing diagram and the two layouts that put “Track your order” on opposite sides of the closing link tag.

- For the diagram , read the paragraph and its alternative together. Can someone tell where the tape goes?

- For the link , inspect its role and accessible name in the browser’s Accessibility panel. Does the name describe the action? Does it pick up an unnecessary image description?

- For the decoration , check that the saved empty value reaches the HTML and that the image is ignored in the tested tree.

If you’re choosing a site builder for a client, try those placements in its preview before you hand over the template. They will tell you whether editors can set a different alternative each time an asset is reused. GenAI’s small-business website builder comparison

Our test used one synthetic illustration, one browser and a fictional storefront. We inspected the browser’s exposed names, not speech from a particular screen reader, and did not measure shopper comprehension or certify the site’s accessibility. What you can reproduce on your own site is the handoff test: reuse a picture, give it two genuinely different jobs, and verify that the live page preserves both decisions.

Sources

  1. W3C WAI, An alt Decision Tree
  2. W3C WAI, Functional Images
  3. W3C WAI, Decorative Images
  4. GenAI, Best AI Website Builder for Small Business: Time-to-Live Ranked

More where this came from

Keep reading.

See all posts →