Skip to content

Fix listing new-tab clicks#369

Merged
Producdevity merged 2 commits into
stagingfrom
fix/listing-new-tab-clicks
May 24, 2026
Merged

Fix listing new-tab clicks#369
Producdevity merged 2 commits into
stagingfrom
fix/listing-new-tab-clicks

Conversation

@Producdevity

@Producdevity Producdevity commented May 23, 2026

Copy link
Copy Markdown
Owner

Description

Fixes the listing new-tab navigation issue from #326.

Re-applies the listing row/card click fix from #326 on the current staging branch. Modifier clicks and middle-clicks now open listing/game links in a new tab without also navigating the current tab. Keep the original contributor as the commit author and left out the old Vitest/package-lock changes from the original PR.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactor
  • Other (please describe):

How Has This Been Tested?

  • Local build
  • Lint
  • Typecheck
  • Unit tests
  • Manual testing

Screenshots (if applicable)

N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I have checked that all checks (lint, typecheck, test) pass

Notes for reviewers

Keep @0xNikilite as the commit author so the original PR author gets credit.

Summary by CodeRabbit

  • New Features
    • Added support for opening listings in new tabs using Ctrl/Cmd+Click, Shift+Click, and middle-click.
    • Improved navigation to properly handle clicks on links within table rows.

Review Change Stack

@vercel

vercel Bot commented May 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
emuready Ready Ready Preview, Comment May 23, 2026 11:27pm

Request Review

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

Walkthrough

This PR refactors navigation behavior across listing pages by introducing shared utilities for keyboard-aware link opening. A new navigation-events module centralizes logic for detecting new-tab intent (Ctrl/Cmd/Shift/middle-click) and guarding against interfering with anchor clicks. SwipeableCard is updated to forward MouseEvents to handlers. Three listing pages and a listing card component adopt these utilities to coordinate click behavior and support opening links in new tabs via modifiers.

Changes

Navigation Event Handling Refactor

Layer / File(s) Summary
Navigation event utilities and tests
src/utils/navigation-events.ts, src/utils/navigation-events.test.ts
Introduces NavigationClickEvent interface and three helpers: shouldOpenInNewTab detects Ctrl/Cmd/Shift/middle-click intent, isAnchorNavigationTarget checks if the click originated from an anchor element, and openInNewTab opens URLs in a new tab with proper security flags. Comprehensive tests cover all conditions.
SwipeableCard event forwarding
src/components/ui/SwipeableCard.tsx, src/components/ui/SwipeableCard.test.tsx
Updates click handlers to accept and forward MouseEvent instead of no-argument handlers, and adds onAuxClick support. Preserves swipe-detection guards. Tests verify click and auxiliary click event forwarding.
ListingCard navigation integration
src/app/v2/listings/components/ListingCard.tsx
Adds navigation utilities and defines navigateToGame/navigateToListing handlers that check for anchor targets, conditionally prevent default navigation for new-tab intent, and use the shared openInNewTab utility. Wires SwipeableCard and external link button to these handlers.
ListingsPage table row navigation
src/app/listings/ListingsPage.tsx
Refactors table row click handling to compute listing URL and use event-aware handlers that guard against anchor clicks, conditionally open in new tab, and otherwise use router.push. Updates game-title link wiring.
PcListingsPage table row navigation
src/app/pc-listings/PcListingsPage.tsx
Applies same navigation pattern as ListingsPage: rows compute listing URL and attach handlers using isAnchorNavigationTarget, shouldOpenInNewTab, and openInNewTab to coordinate click behavior across modifier states.
Server-side import reordering
src/server/repositories/devices.repository.ts, src/server/services/author-risk.service.ts, src/server/services/contributors.service.ts
Reorders import statements to place @orm/sql imports first; no logic or API changes.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely and clearly summarizes the main change: fixing new-tab click behavior for listings.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description covers all required sections: issue reference (#326), type of change (bug fix), testing performed (lint and unit tests), and a checklist. The description is complete and specific.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/listing-new-tab-clicks
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/listing-new-tab-clicks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Producdevity Producdevity merged commit 76f255f into staging May 24, 2026
8 checks passed
@Producdevity

Copy link
Copy Markdown
Owner Author

@0xNikilite thank you for your contribution!

@Producdevity Producdevity deleted the fix/listing-new-tab-clicks branch May 24, 2026 08:51
@0xNikilite

Copy link
Copy Markdown
Contributor

@0xNikilite thank you for your contribution!

np!

@coderabbitai coderabbitai Bot mentioned this pull request May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants