Empty Href Attribute on Links
WCAG Focus: WCAG 2.1.1 (A), 4.1.2 (A)
Writing <a href="">Click to expand</a> or <a href="#">Toggle</a> as a placeholder for a JavaScript action creates broken navigation. An empty href="" causes browsers to reload the current page completely, while href="#" jumps the viewport back to the top of the page.
Why This Pattern Violates WCAG
WCAG 2.1.1 Keyboard (Level A) and 4.1.2 Name, Role, Value (Level A) expect buttons to trigger actions and links to navigate to real destinations.
Screen reader users who activate a link expecting navigation instead get bounced to the top of the page or trigger an unintended reload.
Code Comparison
Inaccessible Empty Href Anchor
<a href="" onclick="toggleFaq(event)">Show Answer</a>
Compliant Button for In-Page Actions
<button type="button" aria-expanded="false" onclick="toggleFaq()">Show Answer</button>
How to Fix It in WordPress
- Convert action triggers with href="" or href="#" into semantic <button type="button"> elements.
- Ensure real navigation links always carry a valid, non-empty destination URL.
Finding This Issue Automatically
Copied code snippets and theme toggles frequently leave behind empty href="" attributes. Running the WP ADA Compliance Check plugin identifies anchor tags with empty href attributes across your WordPress site so you can turn them into clean buttons or valid links.
WCAG References & Supporting Materials
WCAG Success Criteria
Supporting Documentation & Guides
- W3C Failure F42: Emulating links with non-semantic elements or event handlers — Explains why onclick divs/spans and anchor tags without href break keyboard access.
- W3C Technique H30: Providing link text that describes the purpose of a link — Giving every anchor text or linked image alt text that states its destination.
Subscribe
Subscribe to receive daily Web Accessibility - Did you know? articles in your inbox.

