Keep Search page dropdown open across result clicks and modal close

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.
pull/361/head
Broque Thomas 1 month ago
parent 12c23b6b89
commit f684bd603d

@ -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 {

Loading…
Cancel
Save