r/HTML • • Oct 20 '26

Accessible hyperlinks?

Hey folks!

I am hand coding a series of webpages for my employer (don't ask). I just got dinged because the accessibility checker says my hyperlinks are not accessible.

I scratched my head a little bit, did some research and have since added aria-label attributes to the source code.

Still get dinged.

Anyone know how to handle this?

Thanks!

Edit: Here is more or less an example of the code that includes the link.

3 Upvotes

20 comments sorted by

View all comments

4

u/SamIAre Oct 20 '26

Is it giving a specific issue? There are a couple common problems people run into. One is having multiple links on the same page with identical text: Like a series of cards and each says "Read More", so that there's no way for a user to differentiate them.

<!-- Bad -->
<p>Dog breeds: <a href="">Learn More</a>.</p>
<p>Cat breeds: <a href="">Learn More</a>.</p>
<p>Bird breeds: <a href="">Learn More</a>.</p>

<!-- Better -->
<p><a href="">Learn about dog breeds</a>.</p>
<p><a href="">Learn about cat breeds</a>.</p>
<p><a href="">Learn about bird breeds</a>.</p>

Another would be adding an aria-label that doesn't begin with the visible text. For example, you keep your multiple generic links but you give each a unique label to differentiate them. That label must start with the visible text (see Using aria-label for link purpose).

<!-- Incorrect -->
<a href="" aria-label="Dog breeds">Learn More</a>

<!-- Correct -->
<a href="" aria-label="Learn more about dog breeds">Learn More</a>