Alternative text for images
This page is for editors who publish images, administrators who configure content classes, and designers who write image templates. Alternative text serves people who cannot see an image: screen reader users, people with images switched off, and search engines. WCAG 2.2 success criterion 1.1.1 requires it for every informative image (https://www.w3.org/TR/WCAG22/).
Contents
- Writing good alternative text
- Where Exponential keeps it
- Making it required
- Decorative images
- Finding images without alternative text
- Related pages
Writing good alternative text
| Image | Good alternative text | Avoid |
|---|---|---|
| Photo of the town hall on a page about opening hours | Main entrance of the town hall on Market Square | "Image of a building", the file name |
| Chart of budget figures | the conclusion ("Spending on roads rose each year from 2022 to 2025") plus the figures in a table on the page | "Chart" |
| Logo that links to the home page | the destination ("Department of Example, home") | "Logo" |
| Scan of a notice | the text of the notice on the page instead; the image then needs only a short description | the whole text squeezed into alt |
| Pattern, divider, purely decorative photo | empty, if your design writes alt="" (see below) | a description |
Keep it short (one sentence or a phrase), do not start with "Image of", do not repeat the caption word for word.
Where Exponential keeps it
Every image field (datatype ezimage) has an Alternative image text field in the edit form
(design/standard/templates/content/datatype/edit/ezimage.tpl). It is stored with the image of that version and
language, so each translation has its own. Images in the media library are image objects; their alternative text
travels with them when they are embedded.
Making it required
Since 6.0.15 an image attribute of a class has the option Alternative text is required
(kernel/classes/datatypes/ezimage/ezimagetype.php). With it on, an editor cannot store an image in that field
without an alternative text; the form shows "(required)" next to the field.
- Open Setup > Classes, the class (for example Image or Article), Edit.
- On the image attribute, tick Alternative text is required.
- Store the class.
Existing objects keep their images; the rule applies when an image is next stored. A ZIP upload of images skips images where the site requires alternative text, because a ZIP file carries none (Images, media and uploads).
Decorative images
The standard design's image template (design/standard/templates/content/datatype/view/ezimage.tpl) uses the
alternative text and, when it is empty, the object's name as alt; it also uses the same text as title. So an
empty alternative text does not produce alt="" in that template. If your guidelines treat some images as
decorative, ask your designer for an override of the image template (or a separate class or view for decorative
images) that writes alt="" and no title. Then tell editors exactly how to mark an image as decorative.
Finding images without alternative text
- Your own review: a monthly spot check of new pages (see "Monitoring and feedback").
- Optional, Exponential Intelligence (extension
expai, installed by Composer but active only where a site activates it): the edit form gets Write alt text and Decorative (empty alt text) buttons, and the report Missing alt text (/expai/alttext, policyexpai/write) lists images without alternative text below a node; Queue suggestions as drafts writes suggestions into new drafts, never published, for editors to review (Exponential Intelligence). Images are sent to an AI provider, subject to the extension's data policy; decide with your data protection officer before enabling it. - Nothing in the kernel lists images without alternative text across the whole site.
Related pages
- Images, media and uploads
- Images and image variations
- Accessibility standards
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.