Next.js fix

Before and after

Broken — before
// app/components/Navbar.tsx (Broken Next.js brand logo <Link> with no accessible name)
import Link from "next/link";

export function Navbar() {
  return (
    <header>
      <Link href="/" className="brand-logo">
        <svg width="28" height="28" viewBox="0 0 28 28" fill="currentColor">
          <rect width="28" height="28" rx="6" />
        </svg>
      </Link>
    </header>
  );
}
Fixed — after
// app/components/Navbar.tsx (Fixed Next.js <Link> with clear destination label)
import Link from "next/link";

export function Navbar() {
  return (
    <header>
      <Link href="/" aria-label="A11yDrift — Home" className="brand-logo">
        <svg aria-hidden="true" focusable="false" width="28" height="28" viewBox="0 0 28 28" fill="currentColor">
          <rect width="28" height="28" rx="6" />
        </svg>
      </Link>
    </header>
  );
}
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("Next.js Navbar logo and footer social <Link>s pass link-name", async ({ page }) => {
  await page.goto("/");
  await expect(page.getByRole("link", { name: "A11yDrift — Home" })).toBeVisible();
  const results = await new AxeBuilder({ page })
    .withRules(["link-name"])
    .analyze();
  expect(results.violations).toEqual([]);
});

Template deduplication tip

An unlabeled brand logo <Link href='/'> inside app/layout.tsx triggers link-name on every single route of your Next.js app. A11yDrift groups the entire site under one header cluster so one prop addition fixes every page.

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

Does Next.js <Link> forward aria-label directly to the rendered <a> element?
Yes—in Next.js 13+ App Router (and Pages Router without legacyBehavior), <Link> renders a native <a> tag and forwards aria-label, aria-current, and rel directly.
How should I avoid duplicate adjacent links on Next.js blog cards?
Instead of wrapping the thumbnail and title in two separate <Link> elements (which doubles Tab stops), link only the card heading and use a CSS ::after pseudo-element overlay on the card container—or wrap both inside one <Link> with alt="" on the image.
Can I add aria-current='page' to active Next.js <Link> items?
Yes—compare usePathname() against href and pass aria-current={isActive ? 'page' : undefined} so screen-reader users know which navigation route is currently active.