fix(v3): drawer fav-sync honours data-fav-idle (no dim-heart on List View) (#717)

_patchCardFav (the Song Details drawer's like -> card heart sync) hardcoded
`classList.toggle('text-white', !fav)`, so toggling the like from the drawer
left List-View rows' `text-fb-textDim` idle class in place — the exact
dim-heart bug #654 fixed for the on-card click handler, reintroduced on the
drawer path. Read the per-heart `data-fav-idle` and swap that class instead,
mirroring wireCards. +regression assertion in v3_favorites_toggle.test.js.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Byron Gamatos
2026-07-02 14:52:40 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 13db718bda
commit 2e4383524f
2 changed files with 16 additions and 1 deletions
+6 -1
View File
@@ -2354,7 +2354,12 @@
document.querySelectorAll('[data-fn="' + sel + '"] [data-fav]').forEach((btn) => {
btn.textContent = fav ? '♥' : '♡';
btn.setAttribute('aria-pressed', fav ? 'true' : 'false');
btn.classList.toggle('text-fb-accent', fav); btn.classList.toggle('text-white', !fav);
// Swap exactly the idle colour this heart was rendered with (grid =
// text-white, tree/List view = text-fb-textDim) — mirrors wireCards.
// A hardcoded text-white toggle would leave List-View rows' text-fb-textDim
// in place, so the heart changed glyph but stayed dim (never turned red).
const idle = btn.getAttribute('data-fav-idle') || 'text-white';
btn.classList.toggle('text-fb-accent', fav); btn.classList.toggle(idle, !fav);
});
}