The href-less Anchor Anti-Pattern
Why a fake link breaks keyboard and screen reader users.
The Fake Link
A common anti-pattern is an anchor with no href, wired up with a click handler to act like a button. It looks fine but breaks things.
<a onclick="openMenu()">Menu</a>No href, No Link
An anchor only counts as a real link when it has an href. Without one, the browser does not treat it as interactive at all.
All lessons in this course
- Links Go Places, Buttons Do Things
- Link Text That Makes Sense Out of Context
- Buttons That Announce What They Do
- The href-less Anchor Anti-Pattern