Skip to content
easeweb
Search topics

Image uploads that never ask for alt text

A marketplace's listing form uploads each photo and publishes it with its file name as the alt text, without ever asking the seller what the photo shows.

EN 301 549
Clause 5.4Clause 11.8.1Clause 11.8.2Clause 11.8.3Clause 11.8.4Clause 11.8.5
Section 508
504
Broken img.alt = file.name;
The accessibility problem illustrated: No vision:What does the mug look like?
01

The problem

Shoppers who use a screen reader hear a file name instead of what a product looks like, because the form that published the photo never asked the seller to describe it

02

Try it

List the enamel mug with its photo, then hear the published photo as a screen reader would

  • Press Add a photo. The demo picks IMG_2041.jpg for you, as a phone’s photo picker would.

  • Do what the form asks, if it asks anything, and press Publish listing.

  • The panel under the form says what a screen reader reads for the published photo.

Broken Can you fix this?

BrokenA photo published with its file name

New listing

Photos

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Ask what each image shows before it is published

Before
BrokenA photo published with its file name
<form action="/listings" method="post">  <label for="title">Title</label>  <input id="title" name="title">  <label for="photo">Add a photo</label>  <input id="photo" type="file" accept="image/*">  <div id="photos"></div>  <button type="submit">Publish listing</button></form>
What is wrong3 points
  • The seller is never asked what the photo shows: the form adds it the moment it is chosen.
  • The missing description goes unnoticed: the form fills the photo's alt text with the file name, so the photo looks finished.
  • So shoppers hear "IMG_2041.jpg" on the published listing, not what the mug looks like.
After

Ask for a description when the photo is added

<form action="/listings" method="post">  <label for="title">Title</label>  <input id="title" name="title">  <label for="photo">Add a photo</label>  <input id="photo" type="file" accept="image/*">  <div id="photos"></div>  <button type="submit">Publish listing</button></form> <dialog id="describe" aria-labelledby="describe-title">  <form method="dialog">    <h2 id="describe-title">Describe this photo</h2>    <img id="preview" alt="">    <label for="photo-alt">What does the photo show?</label>    <p id="photo-alt-hint">Shoppers who can't see the photo hear this instead. Say what a buyer      would want to know: colour, size, what it's made of.</p>    <textarea id="photo-alt" aria-describedby="photo-alt-hint"></textarea>    <p id="photo-alt-error" hidden>Describe the photo, or tick the box below.</p>    <label><input type="checkbox" id="decorative"> It only decorates the listing: nothing to describe</label>    <button value="add">Add photo</button>    <button value="cancel">Cancel</button>  </form></dialog>
How it is fixed5 steps
  1. When a photo is chosen, open a dialog with showModal() that shows it and asks what it shows. The seller is asked at the moment they know it best.
  2. Tie a hint to the field with aria-describedby, saying who the words are for and what to put in them.
  3. Add a box for a photo that only decorates the listing. It is the seller's override: a photo marked as decorative is published with an empty alt, so screen readers skip it.
  4. If Add photo is pressed with neither a description nor the box ticked, keep the dialog open and say what to do, beside the field, rather than adding the photo with no alt text.
  5. When Add photo closes the dialog, publish the photo with the seller's words as its alt.

This fixes the Before for photos added with the button: the form guides the seller to a description, as EN 301 549 11.8.2 and Section 508 504.3 ask, the box is the override 504.2 asks for, and the published photo passes WCAG 1.1.1.

04

Verify the fix

4 checks, no mouse.

Test with: Keyboard, Screen reader

0 of 4 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after any change to how photos are added.

How screen readers handle aria-describedby and <dialog>

Limits

This guide covers how an authoring tool asks for image descriptions. The same clauses ask more of a tool than this. A text editor must let authors make real headings and lists rather than large bold text, as headings that don't match the page's sections shows from the page's side, and keep them when text is pasted in or converted (EN 301 549 11.8.3, Section 508 504.2.1). Where the tool checks content, it must suggest a repair (11.8.4), and where it offers templates, at least one must be accessible and said to be (11.8.5). Whether the tool's own screens work for authors with disabilities is a separate question, which WCAG and ATAG 2.0 Part A cover; a photo box that takes only dropped files is one such failure, covered in file upload drop zones with no button to choose files. Test with your sellers, and with the shoppers who will read their listings.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service