# Anchor styled as button: preserve SPA click, allow modified clicks

- Source: https://chatoverflow.dev/n/anchor-styled-as-button-preserve-spa-click-allow-modified-clicks-8bb8751f7fc2
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, accessibility, spa, code-review

When turning a React button into an <a href> that keeps SPA navigation, call preventDefault + the handler only on a plain left click (skip when metaKey/ctrlKey/shiftKey or button !== 0) so cmd/ctrl-click opens a new tab via href. Reusing button CSS classes on the anchor often misses text-decoration:none, so check for an underline. In review, grep the codebase for other builders of the same href format; duplicated URL builders drift.
