Skip to content

fix(web): contest cards open in new tab on cmd/middle-click#14333

Merged
dylanjeffers merged 1 commit into
mainfrom
fix/contest-card-cmd-click
May 15, 2026
Merged

fix(web): contest cards open in new tab on cmd/middle-click#14333
dylanjeffers merged 1 commit into
mainfrom
fix/contest-card-cmd-click

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • The ContestCard rendered a <div> with onClick + useLinkClickHandler. That intercepts modifier-clicks correctly for SPA routing, but it never gives the browser an actual <a> element — so cmd-click and middle-click on a card did nothing instead of opening the contest page in a new tab like every other link in the app.
  • Switch to the stretched-link pattern: a real react-router <Link to=...> absolutely positioned over the whole card, so the browser handles cmd/middle-click natively. The existing inner UserLink (already an <a>) and the horizontally-scrolling entries row are elevated above the stretched link via z-index so the artist link stays independently clickable and pill-row scrolling doesn't accidentally trigger navigation.
  • Nesting two anchors stays invalid HTML: the stretched link is a sibling of UserLink, not an ancestor.

Test plan

  • On /contests, regular click on a card navigates to the contest page (in-app, no full reload).
  • Cmd-click (macOS) / Ctrl-click (Windows/Linux) on a card opens the contest page in a new tab.
  • Middle-click on a card opens the contest page in a new tab.
  • Right-click on a card shows the browser's normal link context menu ("Open Link in New Tab", "Copy Link Address", etc.).
  • Clicking the artist name in the card (UserLink) still navigates to the artist profile, not the contest page.
  • Horizontally scrolling the entries pill row inside a card does not trigger navigation.
  • Same checks on the contest cards rendered on the Explore page and the profile Contests tab.

🤖 Generated with Claude Code

The ContestCard was a `<div>` with `onClick` + `useLinkClickHandler`,
which short-circuits SPA navigation for modifier-clicks but doesn't give
the browser an anchor to open in a new tab — so cmd-click and
middle-click on a card did nothing instead of opening the contest in a
new tab like every other link in the app.

Switch to the stretched-link pattern: a real `<Link to=...>` absolutely
positioned over the whole card. UserLink (already an `<a>`) and the
horizontally-scrolling entries row are elevated via z-index so the
artist link stays independently clickable and pill-row scrolling
doesn't accidentally trigger navigation. Nesting two anchors stays
invalid HTML — the stretched link is a sibling of UserLink, not an
ancestor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

⚠️ No Changeset found

Latest commit: 90b654b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14333.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@dylanjeffers dylanjeffers merged commit 6a175ac into main May 15, 2026
14 checks passed
@dylanjeffers dylanjeffers deleted the fix/contest-card-cmd-click branch May 15, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant