Empty Links

Empty Links

WCAG Focus: WCAG 2.4.4 (A), 4.1.2 (A), 1.1.1 (A)

An empty link—such as an <a> tag wrapping an icon font, an empty <span>, or an image missing alt text—leaves keyboard and screen reader users guessing. When a screen reader focuses an empty link, it typically announces only "link" or reads out the raw destination URL.

Why This Pattern Violates WCAG

WCAG 2.4.4 Link Purpose (In Context, Level A) requires the purpose of every link to be determinable from the link text alone or its programmatic context.

WCAG 4.1.2 Name, Role, Value (Level A) fails because the anchor element has an empty accessible name.

Code Comparison

Inaccessible Empty Icon Link

<a href="/cart/"><i class="fa fa-shopping-cart"></i></a>

Compliant Link With Accessible Name

<a href="/cart/" aria-label="View shopping cart">
  <i class="fa fa-shopping-cart" aria-hidden="true"></i>
</a>

How to Fix It in WordPress

  • Remove leftover empty <a> tags created accidentally in the WordPress visual editor.
  • For icon-only links, add an accessible name via aria-label or a visually hidden <span> and hide the decorative icon with aria-hidden="true".

Finding This Issue Automatically

Visual editors and icon-font shortcodes frequently leave behind invisible empty <a> tags that never show up in a quick visual skim. The WP ADA Compliance Check plugin flags empty links across your WordPress pages and will automatically fix the issue by removing empty links from page content.

WCAG References & Supporting Materials

WCAG Success Criteria

Supporting Documentation & Guides

Subscribe

Subscribe to receive daily Web Accessibility - Did you know? articles in your inbox.

Cart Accessibility Tools
hide