How to fix links without a name
WCAG 2.4.4 Link Purpose (In Context) and 4.1.2 Name, Role, Value, level A. Rule link-name in axe-core.
What is wrong
A link has no text that assistive technology can read. It usually contains only an icon (cart, account, Instagram) or an image without alt text. A screen reader announces "link", and the visitor has to follow it to find out where it goes.
Who it blocks
Screen reader users, and voice control users who cannot say the name of a link that has none.
How to fix it
<!-- before -->
<a href="/cart"><svg ...></svg></a>
<!-- after: a name on the link -->
<a href="/cart" aria-label="Cart"><svg aria-hidden="true" ...></svg></a>
<!-- or: text that is visually hidden but read aloud -->
<a href="/cart"><svg aria-hidden="true" ...></svg><span class="visually-hidden">Cart</span></a>
When the link wraps an image, giving the image a meaningful alt also names the link.
Common mistakes
- Naming the icon instead of the destination: "shopping bag icon" instead of "Cart".
- Using the same name for different destinations, such as several "Read more" links.
- Hiding the text with
display: none, which hides it from screen readers too.
How the scan proposes a fix
The scan adds an aria-label guessed from the destination: the network name for social links, "Home" for the home page, a readable path such as "Cart" or "Account" otherwise. It runs the same rule on the fixed markup and checks that no existing attribute changed. Check the guess: it describes the address, not always the purpose.
Check your own pages for free
Drag this button onto your bookmarks bar: Scan with accessaudit. Then open a page of your shop and click the bookmark: a score and the three main defects appear in a few seconds. The check runs in your browser: no content of your page leaves it, only the scanner is downloaded from this site. Try it on a demo shop.