From f684bd603da6967305b424c1a0be05e9798e63fd Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Wed, 22 Apr 2026 21:55:13 -0700 Subject: [PATCH] Keep Search page dropdown open across result clicks and modal close MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On the unified Search page the results dropdown was dismissed three ways that didn't match user intent: - clicking an album row called hideDropdown() before opening the download modal, so the dropdown was already gone by the time the modal closed - clicking a track row did the same - clicking the play button on a track row did the same - the outside-click handler treated a click inside the download modal (its close button or backdrop) as a click outside the dropdown, dismissing it on modal close Reported by Cin: "clicking an album in the search results opens a download modal as expected, but closing said modal also hides the search results in the same go." Drop the explicit hideDropdown() calls from those three handlers and whitelist .download-missing-modal in the outside-click handler. The dropdown now persists across the click + modal lifecycle so the user can pick another result without re-running the search. Artist clicks still dismiss because they navigate to /artist-detail. The global search popover keeps its existing dismiss-on-click behaviour — its high z-index conflicts with the modal stack and auto-dismiss is the right pattern for a Spotlight-style popover. --- webui/static/search.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/webui/static/search.js b/webui/static/search.js index 745b9763..0cae5787 100644 --- a/webui/static/search.js +++ b/webui/static/search.js @@ -204,7 +204,9 @@ function initializeSearchModeToggle() { const dropdown = document.getElementById('enhanced-dropdown'); if (dropdown && !dropdown.classList.contains('hidden')) { const isClickInside = e.target.closest('.enhanced-search-input-wrapper'); - if (!isClickInside) { + // Modal sits above the dropdown; closing it shouldn't dismiss results. + const isClickInModal = e.target.closest('.download-missing-modal'); + if (!isClickInside && !isClickInModal) { hideDropdown(); } } @@ -922,7 +924,6 @@ function initializeSearchModeToggle() { async function handleEnhancedSearchAlbumClick(album) { console.log(`💿 Enhanced search album clicked: ${album.name} by ${album.artist}`); - hideDropdown(); showLoadingOverlay('Loading album...'); try { @@ -1045,7 +1046,6 @@ function initializeSearchModeToggle() { async function streamEnhancedSearchTrack(track) { console.log(`▶️ Stream enhanced search track: ${track.name} by ${track.artist}`); - hideDropdown(); showLoadingOverlay(`Searching for ${track.name}...`); try { @@ -1103,7 +1103,6 @@ function initializeSearchModeToggle() { async function handleEnhancedSearchTrackClick(track) { console.log(`🎵 Enhanced search track clicked: ${track.name} by ${track.artist}`); - hideDropdown(); showLoadingOverlay('Loading track...'); try {