Fix: search results disappear when interacting with the media player (#732)

Search results live in an overlay dismissed by an outside-click handler
whose allow-list omitted the floating media player. Clicking the mini
player to open the now-playing modal (or clicking inside that modal)
registered as an outside click and tore the results down, forcing a
re-search.

Add the media player containers (#media-player mini bar and
#np-modal-overlay expanded modal) to the dismiss allow-lists in both the
Search page (search.js) and the global search widget (downloads.js),
which share the same outside-click pattern. Additive change: only adds
exceptions, so every existing dismiss case is unchanged.
This commit is contained in:
BoulderBadgeDad 2026-05-29 10:18:38 -07:00
parent a4ab70a42c
commit d9a24d48c6
2 changed files with 11 additions and 1 deletions

View file

@ -5709,6 +5709,11 @@ let _gsController = null;
const freshResults = document.getElementById('gsearch-results');
const target = e.target;
if (freshBar?.contains(target) || freshResults?.contains(target)) return;
// The media player (mini bar + expanded now-playing modal)
// floats above the page. Clicking it — e.g. opening the full
// modal from the mini player, or anything inside that modal —
// must NOT tear down the global search results (#732).
if (target.closest && target.closest('#media-player, #np-modal-overlay')) return;
_gsDeactivate();
}, 100);
});

View file

@ -288,7 +288,12 @@ function initializeSearchModeToggle() {
const isClickOnSourceRow = e.target.closest('#enh-source-row');
// Modal sits above the dropdown; closing it shouldn't dismiss results.
const isClickInModal = e.target.closest('.download-missing-modal');
if (!isClickInside && !isClickOnSourceRow && !isClickInModal) {
// The media player (mini bar + expanded now-playing modal) floats
// above the page. Interacting with it — e.g. clicking the mini
// player to open the full modal, or anywhere inside that modal —
// must NOT dismiss the search results (#732).
const isClickInPlayer = e.target.closest('#media-player, #np-modal-overlay');
if (!isClickInside && !isClickOnSourceRow && !isClickInModal && !isClickInPlayer) {
hideDropdown();
}
}