How to fix role img alt on Shopify

Add an accessible text label (aria-label) to every element that has role="img" so screen readers can announce what the image conveys.

Steps for Shopify

  1. Go to Online Store → Themes → click the three-dot menu next to your active theme → Edit code.
  2. In the Layout or Sections panel, open the template file where the flagged element lives (e.g., sections/product-template.liquid, snippets/icon-star.liquid, or snippets/icon.liquid for SVG icons).
  3. Locate the element with role="img" — often an SVG or a <span> wrapping an icon font.
  4. Add aria-label="[descriptive text]" directly to the opening tag, e.g., <svg role="img" aria-label="Free shipping badge" ...>. For icon snippets that are purely decorative, add aria-hidden="true" instead.
  5. For Shopify's built-in star-rating or review app snippets, search snippets/ for 'role="img"' and patch each occurrence.
  6. Save the file, then preview the live theme and verify with axe DevTools or a screen reader.
Official Shopify documentation ↗
<svg role="img" aria-label="4 out of 5 stars customer rating" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20">
  <!-- star path data -->
</svg>

<!-- Decorative icon — hidden from screen readers -->
<span role="img" aria-hidden="true" class="icon-truck"></span>

<!-- Label references visible text elsewhere on the page -->
<div role="img" aria-labelledby="badge-label" class="free-shipping-badge"></div>
<p id="badge-label">Free Shipping on orders over $50</p>

What is role img alt?

When a non-image HTML element (like a `<div>`, `<span>`, or SVG) is given `role="img"` to indicate it acts as an image, browsers and screen readers still need a text description to announce to blind or low-vision users. That description is supplied via an `aria-label` attribute (or an `aria-labelledby` pointing to visible text). If that label is missing or empty, screen readers either skip the element silently or announce something useless like "image" — leaving visitors with no idea what it represents. WCAG Success Criterion 1.1.1 (Non-text Content) requires that every image-like element has a meaningful text alternative.

Roughly 7–8 million Americans use screen readers, and accessibility lawsuits against ecommerce stores have risen sharply every year — missing image labels are one of the most frequently cited violations in ADA Title III litigation. Beyond legal risk, Google's crawler also processes ARIA labels and treats them as descriptive signals, so properly labeled decorative graphics and icon-based UI elements contribute to a cleaner, more crawlable page. Most importantly, customers who rely on assistive technology simply cannot use your store if they cannot understand what your images, icon buttons, SVG badges, or star-rating widgets are — leading to lost sales and brand damage.

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

Not sure if your Shopify store has this?

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

Scan my site free

Fix role img alt on another platform