From d9a24d48c6f812da8d485ea8fe9c76bc2f186e94 Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Fri, 29 May 2026 10:18:38 -0700 Subject: [PATCH] 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. --- webui/static/downloads.js | 5 +++++ webui/static/search.js | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/webui/static/downloads.js b/webui/static/downloads.js index 714ae934..39f0cf5a 100644 --- a/webui/static/downloads.js +++ b/webui/static/downloads.js @@ -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); }); diff --git a/webui/static/search.js b/webui/static/search.js index cd27d34e..f963f465 100644 --- a/webui/static/search.js +++ b/webui/static/search.js @@ -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(); } }