Testing SVG
This page tests SVG accessible name behaviour on its own, without an interactive wrapper. Compare with testing SVG images inside links, where the SVG sits inside an <a>. Here, each SVG is entirely standalone, no link, no button, nothing making it interactive.
Example 1: no name
Expected result: no accessible name is expected. Confirmed: the name-prohibited-roles bookmarklet found no issue here, SVG's implicit role is not on that list. Still worth confirming with a screen reader directly whether this SVG is exposed as a meaningful object at all.
HTML markup
<svg></svg>
Example 2: aria-label
Expected result: "Close" should be the accessible name. Confirmed: the name-prohibited-roles bookmarklet found no issue with aria-label here, no role="img" needed to avoid that specific concern. Whether it's needed for reliable announcement is a separate question, see Example 5.
HTML markup
<svg aria-label="Close"></svg>
Example 3: <title>
Expected result: "Close" should be the accessible name, via the native SVG <title> element, the SVG equivalent of alt. Confirmed: the name-prohibited-roles bookmarklet found no issue here either.
HTML markup
<svg>
<title>Close</title>
</svg>
Example 4: aria-hidden, decorative icon
This is the common pattern used by icon libraries such as Font Awesome, a purely decorative icon that should never be announced.
Expected result: this SVG should be entirely excluded from the accessibility tree and never announced. This is the one example on this page with a well-established, uncontested outcome, decorative content hidden via aria-hidden is a settled, reliable pattern.
HTML markup
<svg aria-hidden="true"></svg>
Example 5: role="img" with aria-label
This example adds role="img" alongside aria-label. This is included as an open comparison, not a demonstrated fix.
Expected result: "Close" should be the accessible name, the same outcome as Example 2. Testing confirms role="img" is not required here to avoid a name-prohibited role. Historically, role="img" was recommended for a different reason, inconsistent browser support for SVG's implicit role. Whether that's still true, and whether it makes any measurable difference to actual screen reader announcement compared with Example 2, is worth testing directly rather than assuming either way.
HTML markup
<svg role="img" aria-label="Close"></svg>