Accy

Links with no destination, driven by JavaScript

WCAG 2.1.1, 4.1.2 (A) · EN 301 549 9.2.1.1

There are <a> elements with no href that still respond to clicks.

Why it matters

An <a> without href does not receive keyboard focus and is not announced as a link. Anyone navigating with Tab simply cannot reach it: for that person the element does not exist.

How to fix it

If it navigates somewhere, give it a real href. If it performs an action on the page (opening a menu, a modal), use a <button>, which is keyboard-accessible already.

As it is
<a onclick="openMenu()">Menu</a>
As it should be
<button type="button" onclick="openMenu()">Menu</button>

Related

Does your shop have this failure?

Check for free, along with the other 54 rules. No sign-up.

No sign-up. We scan one public page and store nothing about you.