Bài viết này hiện chỉ có bằng tiếng Anh.

AccessibilityMar 12, 20266 min read

Image Accessibility and Optimization: Do Not Break Alt Text Workflows

Image optimization should make a page faster without making it less understandable. When teams replace files, regenerate media, or rewrite image markup, they can accidentally drop alt text, captions, figure relationships, dimensions, or editorial metadata. That is not a technical detail. It changes how people understand the page.

The image workflow should treat accessibility as part of optimization, not as a separate cleanup task.

Stopping at smaller files ignores whether the rendered page still has meaning. That is not acceptable for accessibility-sensitive work. The review should preserve alt decisions, captions, attachment relationships, generated markup, owner review, and rollback notes alongside any WebP or AVIF output.

This matters whether the conversion happens in a CMS, a build script, or a local CLI workflow. GetWebP's CLI commands reference documents a useful safety property for file-based workflows: original files are not modified or deleted. In WordPress, the frontend delivery guide describes <picture> delivery where the fallback <img> keeps its attributes, which is exactly the kind of behavior accessibility review should verify.

Alt Text Belongs to Context#

Alt text is not simply a property of a file. It describes what the image means in a specific context. The same product photo may need different alt text on a product page, a comparison article, and a press release.

The W3C's alt decision tree is a helpful reference for deciding how images should be described or marked decorative. Use it when reviewing templates, not only when writing content.

When converting images to WebP, keep the relationship between the image and its contextual alt text intact.

Do Not Replace Attachments Blindly#

CMS media records often hold alt text, captions, descriptions, credits, and usage relationships. If a workflow creates a new optimized file as a separate media item, editors may accidentally lose the metadata attached to the original.

Before replacing an image, check:

  • alt text
  • caption
  • credit
  • figure or gallery relationship
  • featured image connection
  • product image association
  • structured data or social preview reference

The optimized file should inherit the publishing context or be attached deliberately.

For a bulk job, keep a media handoff sheet instead of relying on filenames:

source_path,new_path,alt_text,caption,credit,owner,review_status
/uploads/setup-flow.png,/uploads/setup-flow.png.webp,"Setup screen showing API key field","Initial setup flow","Product team","Docs","approved"

That record helps editors confirm that optimization did not create orphaned images with no meaning, credit, or owner.

Preserve Meaningful Captions#

Captions often carry information the image alone does not. A chart image may need a caption explaining the data source. A photo may need a credit. A product image may need a variant note.

Compression and format conversion should not remove those relationships. If a build process rewrites image markup, confirm that <figure> and <figcaption> structures remain valid where used.

MDN's img element reference is useful background for attributes such as alt, width, height, and loading behavior.

A safe rewrite keeps the semantic relationship intact:

<figure>
  <picture>
    <source srcset="/images/chart.webp" type="image/webp" />
    <img src="/images/chart.png" alt="Revenue increased after the pricing change" width="960" height="540" />
  </picture>
  <figcaption>Monthly recurring revenue before and after the pricing change.</figcaption>
</figure>

The WebP file is not the accessibility object. The rendered <img>, its surrounding content, and the editorial context are.

Watch Decorative Images#

Decorative images may need empty alt text rather than descriptive alt text. Optimization can accidentally change this if a generated component requires an alt value or uses the filename as a fallback.

Avoid bad defaults such as:

<img src="/images/blue-wave.webp" alt="blue-wave.webp" />

For decorative images, a meaningful empty alt attribute can be better than noisy filename text. The accessibility decision should be preserved when the file format changes.

The regression to watch for is automated fallback text. If an optimizer, CMS plugin, or component library fills missing alt values from filenames, decorative assets become noisy:

<img src="/images/blue-wave.webp" alt="" />

That empty value is intentional when the image is decorative. It should not be "improved" into a filename by an automated workflow.

Keep Text Out of Images When Possible#

Some marketing and social graphics include text inside the image. That text may not be accessible, scalable, translatable, or searchable. A smaller WebP file does not fix those issues.

When the text is important to understanding the page, consider moving it into HTML. If text must remain in the image, provide appropriate surrounding text or alt text according to the image's role.

Optimization should not make inaccessible design patterns more attractive simply because the file is lighter.

Check Generated Markup#

Image optimization plugins, build tools, and CDNs may rewrite markup. They might wrap images in picture, add lazy-loading placeholders, replace URLs, or insert responsive candidates. After enabling a tool, inspect the final HTML.

Confirm:

  • alt text remains present
  • decorative images remain decorative
  • captions stay associated
  • width and height are not removed
  • picture fallback still includes the same alt text
  • lazy-loading changes do not hide important content

The final page is what assistive technologies and users encounter.

For WordPress delivery, verify the rendered frontend, not just the Media Library row. A plugin may generate WebP and AVIF siblings while the theme controls the final markup. Check a post page, product page, gallery, featured image, and social preview path if those surfaces matter.

Include Accessibility in QA#

Visual review should be paired with accessibility checks in the image QA process:

Image meaning reviewed
Alt text preserved or updated
Caption relationship preserved
Decorative status preserved
Text inside image reviewed
Generated markup checked
Fallback path checked

This keeps accessibility from being forgotten during bulk conversion work.

For static sites, add a lightweight markup check to the pull request:

Converted files reviewed
No filename-derived alt text introduced
Intentional empty alt values preserved
picture/source fallback renders
width and height still present where the template expects them
captions and credits still visible
content owner approved changed hero/product images

The point is not to let a script decide whether alt text is good. The point is to catch workflow damage caused by file replacement or markup generation.

Keep Editors in the Workflow#

Editors and content owners often understand why an image is present. Developers may understand file formats and delivery. Good optimization needs both.

If a tool changes media records, editors should know how to review and correct descriptions. If developers change templates, editors should know whether the old alt text fields still apply. Avoid workflows where optimized files appear without context and editors must guess what they represent.

A useful handoff note is short:

What changed: generated WebP siblings for existing product images
What did not change: original files, attachment IDs, alt text fields, captions
Needs editor review: five new campaign images added as separate assets
Needs developer review: product gallery picture markup on mobile
Rollback: disable WebP delivery or restore previous template branch

Image optimization should improve speed while preserving meaning. WebP, responsive images, and local conversion workflows are useful, but they must keep alt text, captions, and semantic relationships intact so the page remains understandable to everyone.

Jack avatar

Jack

GetWebP Editor

Jack writes GetWebP guides about local-first image conversion, WebP workflows, browser compatibility, and practical performance checks for teams that publish images on the web.