WordPress fix

Before and after

Broken — before
<?php // footer.php (Broken WordPress social icon link) ?>
<a href="https://github.com/example" class="social-link">
  <i class="fa-brands fa-github"></i>
</a>
Fixed — after
<?php // footer.php (Fixed WordPress social link with .screen-reader-text) ?>
<a
  href="https://github.com/example"
  class="social-link"
  rel="noopener noreferrer"
>
  <i class="fa-brands fa-github" aria-hidden="true"></i>
  <span class="screen-reader-text"><?php esc_html_e( 'Visit our GitHub profile', 'mytheme' ); ?></span>
</a>
Live preview

Fixed vs. broken example

Passes link-name
Accessibility tree: role="link", accessible name="View A11yDrift on GitHub" (SVG marked aria-hidden="true")

Open the VoiceOver Web Rotor (Control+Option+U) or NVDA Elements List (NVDA+F7) to confirm every icon anchor shows a clear destination label.

Automated test

Playwright + axe-core check

tests/a11y-link-name.spec.ts
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";

test("WordPress header, archive, and footer links pass axe-core link-name", async ({ page }) => {
  await page.goto("/");
  const results = await new AxeBuilder({ page })
    .withRules(["link-name"])
    .analyze();
  expect(results.violations).toEqual([]);
});

Template deduplication tip

An unlabeled icon link in footer.php or empty thumbnail link in archive.php generates violations across every category, tag, and post page. A11yDrift condenses those into one WordPress template cluster.

Screen readers

What NVDA and VoiceOver announce

Screen-reader users routinely pull up a rotor or links list to jump straight to destinations. Bare icon anchors, empty product-image wrappers, or unlabeled social links appear as meaningless raw URLs or blank entries.

NVDA (Windows)

Broken

"link, #social-demo" (raw href fragment read verbatim)


Fixed

"View A11yDrift on GitHub, link"

VoiceOver (macOS / iOS)

Broken

"link" (or raw URL path)


Fixed

"View A11yDrift on GitHub, link"

Common questions

Why does WordPress's featured-image link fail link-name on archive pages?
When <a href='...'><?php the_post_thumbnail(); ?></a> renders an <img> with empty alt="", the enclosing link has zero text. Either bind non-empty alt text, add aria-label with the post title, or link the heading only.
Do Gutenberg's core Social Icons blocks pass axe-core link-name?
Modern WordPress core Social Icons blocks output an aria-label automatically when a service is chosen, though custom SVG icon blocks and legacy page builders (Elementor/WPBakery) often omit it unless configured.
What if a WordPress 'Back to Top' anchor only contains an arrow icon?
Add <span class='screen-reader-text'>Back to top</span> inside the anchor and aria-hidden='true' on the arrow icon so screen readers announce the destination cleanly.