How to fix svg img alt on Adobe Commerce (Magento)

Add a meaningful text alternative to every SVG image so screen readers can describe it to visually impaired shoppers.

Steps for Adobe Commerce (Magento)

  1. SVGs in Adobe Commerce live in theme directories under app/design/frontend/<Vendor>/<theme>/web/images/ (SVG asset files) and in .phtml template files or layout XML. Use your IDE or FTP to navigate there.
  2. For inline SVGs in .phtml templates: open the relevant template file, locate the `<svg>` element, and add `role="img"` and `aria-label="<?= $escaper->escapeHtmlAttr(__('Descriptive text')) ?>"` to the opening tag — using the escaper and translation helper for best practice.
  3. For SVG asset files referenced in templates or CSS: open the SVG in a text editor, add `<title id="svg-t1">Descriptive text</title>` as the first child of the root `<svg>` element, add `role="img" aria-labelledby="svg-t1"` to the `<svg>` tag, and save. Then run `bin/magento setup:static-content:deploy` to republish static assets.
  4. For decorative SVGs, add `aria-hidden="true"` to the `<svg>` tag in the relevant .phtml file or SVG asset.
  5. Flush caches: Admin > System > Cache Management > Flush Magento Cache (or `bin/magento cache:flush`).
  6. Verify in the browser using axe DevTools or Chrome Accessibility panel.
Official Adobe Commerce (Magento) documentation ↗

What is svg img alt?

SVG files are vector images often used for logos, icons, badges, and illustrations on ecommerce sites. Unlike a regular `<img>` tag which has an `alt` attribute, an inline SVG element needs its own internal mechanism to carry a text description — either a `<title>` element nested inside it, an `aria-label` attribute on the `<svg>` tag itself, or a reference to external text via `aria-labelledby`. Without one of these, a screen reader either skips the image entirely or reads out meaningless code, leaving blind and low-vision shoppers without context for what the image conveys. WCAG Success Criterion 1.1.1 ("Non-text Content") requires that all meaningful images have a text alternative.

Screen readers are used by millions of shoppers with visual impairments, and an SVG without a text alternative is completely invisible to them — a missing logo, an unreadable trust badge, or a broken call-to-action icon. This directly harms conversions and user experience for a significant customer segment. From a legal standpoint, failing WCAG 1.1.1 is one of the most commonly cited violations in ADA and AODA accessibility lawsuits and demand letters targeting online stores; remediating it proactively protects you from costly litigation. Google's crawlers also partially interpret accessibility markup, so well-labelled SVG images can contribute to better understanding of your page content.

See the complete Svg img alt guide for every platform and the full background.

Not sure if your Adobe Commerce (Magento) store has this?

Run a free SEOLZ scan — we’ll find svg img alt and every other issue across your whole site.

Scan my site free

Fix svg img alt on another platform