An <a> without an href is semantically not a link. It's basically a <span>, even if it has an onclick handler that navigates the user.
It won't receive keyboard focus, and screenreaders probably* won't announce it as a link. #a11y
*scottohara.me/note/2019/07/1…
5
35
2
131
If you're using an hrefless <a> to represent where a link might go, such as the current page in a list of breadcrumbs, this might be fine.
But if you want your link to behave like a link, you should have an href.
1
6
I didn’t know it was possible to have an <a> tag without an href. 😲
I always put them in for sure, though.
1
1
Indeed at such as in the same page!
Sep 20, 2022 · 1:21 AM UTC
1




