Library cards: in-card badges no longer trigger artist-detail navigation

The card is an <a> link and the shell's capture-phase link handler navigated to artist-detail before the grid's bubble-phase badge handler could preventDefault — so clicking the watchlist eye or a source badge opened the detail page (and the badge's own link too). The shell handler now bails when the click lands on an in-card control (.source-card-icon or [data-no-card-nav]), letting the badge do only its own thing.
This commit is contained in:
BoulderBadgeDad 2026-06-25 13:57:34 -07:00
parent 7a8b66fd2e
commit e3915b63e6

View file

@ -211,6 +211,11 @@ function _handleShellLinkClick(event) {
if (!anchor || (anchor.target && anchor.target !== '_self')) return;
if (anchor.hasAttribute('download')) return;
// In-card controls (source/watchlist badges, etc.) handle their OWN click — don't let
// this capture-phase handler hijack it into the surrounding card's navigation. Their
// bubble-phase handlers preventDefault, but that runs after capture, so we opt out here.
if (event.target?.closest?.('.source-card-icon, [data-no-card-nav]')) return;
const href = anchor.getAttribute('href');
if (!href || href === '#' || href.startsWith('javascript:')) return;