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.

0 Upvotes

20 comments sorted by

View all comments

2

u/armahillo Expert Oct 20 '26

Can you put your code into a codepen or jsfiddle and share it here so we can look?

Theres not enough information here to know for certain. Also what a11y checker are you using?

1

u/50_and_stuck Oct 20 '26

Edited original comment to include sample code.

4

u/armahillo Expert Oct 20 '26

This is helpful thanks, though it would be useful to know which a11y checker they're using too.

  1. `aria-label` isn't really necessary, because you should just make the label be the link text. The user doesn't need to see the URL. So something like "<a ...>View on the MoMA website</a>" would be fine. Screenreaders will likely read out a URL character by character ("h t t p colon slash...") if it's the link text. Aria-labels that mismatch will mean someone using speech-based browsing will not be able to correctly identify the link because they might say "click on h-t-t-p-..." but the document will identify it with the aria label.
  2. You have it opening in a new tab (target="_blank") but this is not indicated by the link text, so making the link text also have "(opens in new tab)" would be good.

What purpose is the "inline-disabled" doing here?

1

u/50_and_stuck Oct 20 '26

The LMS we use inserted those attributes. All I added was the aria-label.