Check 11.04 · Semantic HTML and accessibility

Distinguish action buttons from navigation links

Use an a href link to go to a page and a button to act on the page, each with a clear name, in your themes, page builders and components.

Priority
Important
Difficulty
Easy
Estimated time
1 h to 1 day
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

A link (<a href>) takes you somewhere: another page, an anchor, a file. A button (<button>) triggers an action on the page: add to cart, open a menu, submit a form, show more results. The check consists of verifying that every clickable element uses the right one of the two, whatever its styling, and that it has an understandable name. Expected result: everything that navigates is a crawlable link, everything that acts is a button usable with the keyboard, and no <div> pretends to be either one.

Why it matters

The two elements have neither the same behavior nor the same meaning for programs:

Link <a href> Button <button>
Announced role “link” “button”
Keyboard activation Enter Enter and Space
Open in a new tab, copy the address yes no
Followed by crawlers yes, if href is a real URL no
Works without JavaScript yes only inside a form

Google states that it can generally crawl a link only if it is an <a> element with an href attribute. A button that navigates with JavaScript therefore passes on neither discovery nor internal linking signals to the target page. Conversely, a link used for an action (<a href="#" onclick="ajouterAuPanier()">) clutters crawling with empty URLs and cannot be activated with the space bar.

Screen reader users expect to change page after a link and to stay on the page after a button. AI agents that browse on a user's behalf also, in all likelihood, rely on the type and name of elements to decide where to click: a “button” named “Add to cart” is easier to interpret than a <div> with an icon.

What it improves

  • Crawling and internal linking Navigation becomes links that crawlers follow.
  • Accessibility The right role announced, keyboard activation, an accessible name. WCAG criteria 2.1.1 (Keyboard) and 4.1.2 (Name, Role, Value), RGAA (French accessibility framework) criteria 6.1, 7.1 and 7.3.
  • AI agents Controls identifiable by their role and name. A likely effect, but poorly documented by vendors. See identify what each button does (opens in a new tab).
  • Usability Middle-click and new tab on links, no double submission on form buttons.
  • Ranking An indirect effect, through discovery and internal linking of the linked pages.

How to check

1. The right-click and space bar test. Right-click each element that leads to another page: the menu should offer “Open link in new tab”. With the keyboard, move focus to each element that acts on the page and press Space: the action should trigger without scrolling the page.

2. In the developer tools console, list the links that are not really links and the buttons that navigate:

console.table([...document.querySelectorAll('a:not([href]), a[href="#"], a[href^="javascript:"], [role="button"], [role="link"], [onclick]')]
  .map((el) => ({
    balise: el.tagName.toLowerCase(),
    href: el.getAttribute('href') || '',
    role: el.getAttribute('role') || '',
    texte: (el.textContent.trim() || el.getAttribute('aria-label') || '(empty)').slice(0, 50),
  })));

Then the controls with no accessible name:

console.table([...document.querySelectorAll('a[href], button')]
  .filter((el) => !el.textContent.trim() && !el.getAttribute('aria-label') && !el.getAttribute('aria-labelledby') && !el.querySelector('img[alt]:not([alt=""]), svg title'))
  .map((el) => ({ balise: el.tagName.toLowerCase(), classe: el.className, html: el.outerHTML.slice(0, 100) })));

3. Automated audit. Lighthouse, axe DevTools and WAVE flag buttons and links with no accessible name. Lighthouse's SEO category flags links that are not crawlable.

4. Listen to the page. The VoiceOver rotor (VO + U) or the NVDA elements list (Insert + F7) show links and buttons separately: each one should have a distinct name that makes sense out of context (“Learn more” repeated ten times does not).

How to implement

Before you start

One question settles each case: does the address in the browser bar change? If so, it is a link. If not, it is a button.

Clickable element Right element
“View product”, product card, menu item <a href="/produits/oslo">
“Download the PDF sheet” <a href="/fiche.pdf" download>
“Request a quote” that opens a form page <a href="/devis">
“Add to cart”, “Send” <button type="submit"> inside a form
Open a menu, a dialog, an accordion <button type="button" aria-expanded="false">
“Show more results” <button>, plus real pagination links
Tabs that switch a panel on the same page <button> inside a tabs component
Log out <button> inside a POST form

Styling is independent of the element: a link can look like a button, and vice versa.

<a class="bouton" href="/devis">Request a quote</a>

<form action="/panier" method="post">
  <input type="hidden" name="produit" value="oslo">
  <button class="bouton" type="submit">Add to cart</button>
</form>

<button type="button" aria-expanded="false" aria-controls="menu-principal">Menu</button>

Three more rules:

  • Always set a type on <button>: without it, a button placed inside a form submits it (type="submit" by default).
  • A name for every icon button: visually hidden text or aria-label.
<button type="button" aria-label="Close the dialog">
  <svg aria-hidden="true" width="16" height="16"><use href="#icone-croix"></use></svg>
</button>
  • No fake buttons: a <div role="button" tabindex="0"> has to reimplement Enter, Space, the disabled state and focus. Use <button>.

To replace navigation done with onclick, router.push() or location.href, follow avoid links that rely solely on JS events (opens in a new tab).

WordPress

Versions WordPress 6.4 and later, WooCommerce 9 and later.

  • Buttons block: each button outputs an <a href> when a link is set. That is correct for navigation; do not use it for an action that does not change page.
  • Forms (form plugins, WooCommerce): submit buttons and “Add to cart” are <button> or <input type="submit"> elements. Check that a theme or page builder has not replaced them with styled links.
  • Page builders: for a button widget that opens a modal, check in the generated code that the element is a <button> or at least has a role="button" handled with the keyboard. If not, prefer a link to a real page.
  • Mobile menu: the Navigation block's open button is a <button> with aria-expanded. Keep it.

Shopify

Versions Online Store 2.0 themes (Horizon, Dawn), all Shopify plans, November 2026.

In recent themes, “Add to cart” is a <button type="submit"> inside the product form, and product cards contain a link to {{ product.url }}. Points to check in custom sections:

<a class="button" href="{{ section.settings.button_link }}">{{ section.settings.button_label | escape }}</a>

<button type="button" class="button" aria-expanded="false" aria-controls="Filtres-{{ section.id }}">
  {{ 'products.facets.filter_button' | t }}
</button>

A section setting that accepts a URL must output an <a href>, never a <button onclick>.

Wix

Versions Wix Editor and Wix Studio, November 2026.

Wix Button elements output a link when you attach a page or URL to them under Link. For an action (opening a lightbox, triggering Velo code), check the announced role with a screen reader and give the button an explicit label. Avoid clickable images with no text: add text or alternative text that describes the destination.

Squarespace

Versions Squarespace 7.1, November 2026.

Button blocks output links to a page, a URL or a file: that suits navigation. For an action, use the dedicated blocks (form, product) rather than a button linked to #.

Webflow

Versions Webflow Designer, November 2026.

Webflow's Button element is a link (<a>): reserve it for navigation and always set its destination in Settings. For an action, use a Form Button inside a form, or the custom element with the button tag and the type="button" attribute. Webflow interactions triggered on a Div Block are not keyboard accessible: attach them to a real button.

Laravel

Versions Laravel 11 to 13, Livewire 3 and 4.

Create two separate Blade components, one for links and one for buttons, with the same styling:

{{-- resources/views/components/link-button.blade.php --}}
<a {{ $attributes->merge(['class' => 'bouton']) }}>{{ $slot }}</a>

{{-- resources/views/components/button.blade.php --}}
<button {{ $attributes->merge(['type' => 'button', 'class' => 'bouton']) }}>{{ $slot }}</button>

Actions that modify data (logging out, deleting) go through a POST, DELETE or PATCH form with @csrf and a <button type="submit">, never through a GET link. With Livewire, wire:click goes on a <button>; for navigation, use <a href="…" wire:navigate>.

Next.js

Versions Next.js 15 and 16 (App Router).

The Link component from next/link outputs an <a href>: use it for all navigation. For an action, a <button>; for a mutation, a form with a Server Action:

import Link from 'next/link';
import { ajouterAuPanier } from './actions';

export function CarteProduit({ produit }: { produit: { slug: string; nom: string; id: string } }) {
  return (
    <article>
      <h3>
        <Link href={`/produits/${produit.slug}`}>{produit.nom}</Link>
      </h3>
      <form action={ajouterAuPanier}>
        <input type="hidden" name="id" value={produit.id} />
        <button type="submit">Add to cart</button>
      </form>
    </article>
  );
}

Component libraries often offer a property that renders a button as a link (asChild, as="a", component={Link}): use it to keep the button styling on a real link.

Nuxt

Versions Nuxt 3 and 4.

<NuxtLink to="…"> to navigate, <button type="button" @click="…"> to act. If a UI component accepts a to property, check that it then renders an <a> and not a <button>.

Common mistakes

  • <a href="#"> to open a menu or a dialog: the crawler sees a link to the page itself, and the space bar scrolls the page instead of acting.
  • A <button> that redirects to an indexable page: the target page is not discovered through that path.
  • A <button> with no type inside a form: it submits the form instead of opening help or adding a row.
  • Icon buttons with no name: just “button” for a screen reader, and an incomprehensible control for an agent.
  • Repeated generic labels (“Learn more”, “Click here”): prefer text that names the destination, or supplement it with visually hidden text.
  • Disabling a button without explanation: a grayed-out button with no message leaves the user and the agent without a clue. See provide clear error messages (opens in a new tab).

Frequently asked questions

How do I name a button that contains only an icon?

Give it an accessible name that describes the action, with visually hidden text inside the button or an aria-label attribute, for example “Close the dialog” or “Add to favorites”. Hide the icon itself from assistive technologies with aria-hidden="true". Avoid relying on the title attribute, which is unreliable with the keyboard and on mobile, and check the resulting name in the browser's accessibility tree.

Updated on

Topic checklist (PDF)

And now?

In the “Semantic HTML and accessibility” topic

  1. Use header, main, nav, article and footer appropriately
  2. Use elements suited to the content
  3. Structure tables and lists with native elements
  4. Distinguish action buttons from navigation links
  5. Provide ALT text for informative images
  6. Use empty ALT for decorative images
  7. Check color contrast
  8. Test keyboard navigation
  9. Check form labels
  10. Use ARIA when necessary
  11. Check DOM reading order
  12. Avoid information available only on hover
  13. Provide text alternatives for media
  14. Check applicable WCAG guidelines
  15. Test with axe, WAVE or Lighthouse