Names for inline SVG icons

How the scan finds inline SVG graphics that have no accessible name, in two exact cases, when it fails, and how to name or hide them.

What AuditX checks

The scan reads the HTML of the page and looks at inline svg elements. It reports two cases only. The first is an svg with role="img" that has no accessible name. A name counts when the svg has an aria-label, an aria-labelledby that points at an element with text, or a title element as a direct child. An svg with aria-hidden="true" is skipped, and so is one inside a link or button that already has a name (an aria-label, aria-labelledby or title attribute on it, or text in it). The second case is an svg that is the only content of a link (a with href) or a button, where the link or button has no aria-label, aria-labelledby or title and the svg has no name of its own. The check passes when none of these are found. It fails when at least one is found, and the message names up to 5 places: a link by the address it goes to, a button by its id or first class, with how often each occurs. There is no warn. When the page has no inline svg at all, it is an info note, which does not lower the score. The scan does not judge svg elements that have no role and are not alone inside a link or button, does not look at svg files loaded through an img tag or a CSS background, and does not judge whether a name is a good description.

Why it matters

W3C WCAG 2.2 success criterion 1.1.1 (Non-text Content) asks that content which is not text has a text alternative that serves the same purpose. A link or button that holds only an icon is announced by a screen reader as a bare link or button without it.

MDN explains that an element with role="img" must have an accessible name, and that the name can come from aria-label, aria-labelledby or a title element inside the svg.

How to fix it

  1. For an icon that sits alone inside a link or button, add an aria-label to the link or button that says what it does, for example Open the cart.
  2. For an svg that carries meaning on its own, keep role="img" and add a title element as the first child, or an aria-label.
  3. For an icon that only decorates text that is already there, add aria-hidden="true" to the svg.
  4. Test with a screen reader or the accessibility panel of your browser developer tools and listen to each icon button once.
<a href="/cart" aria-label="Open the cart">
  <svg viewBox="0 0 24 24" aria-hidden="true">...</svg>
</a>

Does your site pass this check? A free scan runs it with every other check and shows the result in about a minute.

Scan my site

Sources

Related checks

Last reviewed 2026-11-13.