Description: When the custom context menu is open, clicking anywhere else on the screen (e.g., on another podcast row) should only close the context menu. Currently, it closes the menu but also triggers the action on the element clicked (like selecting a different podcast).
Attempts to Fix:
- Attempt 1: Added a
mousedownlistener ondocumentto hide the menu.- Result: Menu closed, but propagation continued to the underlying element.
- Attempt 2: Added explicit
elements.contextMenu.classList.add("hidden")inside thetoggleEpisodefunction.- Result: Menu closed, but selection still occurred because
toggleEpisodewas still being called.
- Result: Menu closed, but selection still occurred because
- Attempt 3: Implemented a
mousedownlistener onwindowusing the Capture Phase (true) withe.stopPropagation()ande.stopImmediatePropagation().- Result: Failed to block the selection, likely because the browser-level checkbox toggle or other event types (like
click) were still firing.
- Result: Failed to block the selection, likely because the browser-level checkbox toggle or other event types (like
- Attempt 4: Shared the capture-phase logic between both
mousedownandclickevents to catch and consume the interaction at the earliest possible stage.- Result: User reports the issue still persists.
Hypothesis: The episode selection logic might be triggered by an event we aren't yet intercepting in the capture phase (perhaps pointerdown or a specific interaction within the Tauri/WebView environment), or the DOM structure of the episode-item is capturing the event in a way that bypasses the window-level interceptor.