fix: video sidebar highlight needed two clicks (music chrome wiped it)

setActivePageChrome cleared .active from EVERY .nav-button — including the video
sidebar's — but only re-highlighted music buttons ([data-page]). On the first video
nav it ran (via navigateToPage) and wiped the video selection right after the video
side set it; the second click hit navigateToPage's same-page early-return so it
didn't run, which is why the highlight only 'stuck' on the second click.

Scope the clear to .nav-button[data-page] (music nav only). The video side owns its
own .nav-button[data-video-page] highlight via setActiveNav. Zero music-side impact
(all music nav buttons carry data-page).
This commit is contained in:
BoulderBadgeDad 2026-06-19 13:36:00 -07:00
parent 9b1d76b4ff
commit 958a5cd0a4

View file

@ -20,7 +20,11 @@ function showLegacyPage(pageId) {
}
function setActivePageChrome(pageId) {
document.querySelectorAll('.nav-button').forEach(btn => {
// Only manage MUSIC nav buttons (they carry data-page). The video sidebar owns
// its own highlight via .nav-button[data-video-page]; clearing those here wiped
// the video selection on the first nav — it only re-stuck on a second click,
// which hits navigateToPage's same-page early-return so this never ran. (#sidebar)
document.querySelectorAll('.nav-button[data-page]').forEach(btn => {
btn.classList.remove('active');
btn.removeAttribute('aria-current');
});