From d8dcb82cde7ba2837730cef2b95eb1262c826c91 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 6 Nov 2026 16:50:09 +0100 Subject: [PATCH] fix: file preview closes on any click when opened from the Controls menu (#33831) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Opening a file from Controls → Files and clicking anything in its window, such as the Preview tab, closed the window together with the menu. Clicks inside a window opened from a menu no longer count as clicks outside it, so the preview stays open. Fixes #33828 --- src/lib/components/common/Dropdown.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/common/Dropdown.svelte b/src/lib/components/common/Dropdown.svelte index 0e4bcd118f..5543e6a6bb 100644 --- a/src/lib/components/common/Dropdown.svelte +++ b/src/lib/components/common/Dropdown.svelte @@ -330,10 +330,10 @@ if (!(event.target instanceof Node)) return; if (triggerEl?.contains(event.target)) return; if (contentEl?.contains(event.target)) return; - // Submenus and listboxes can be portaled outside contentEl. + // Submenus, listboxes and modals can be portaled outside contentEl. const portaled = event.target instanceof Element - ? event.target.closest('[role="menu"], [role="listbox"]') + ? event.target.closest('[role="menu"], [role="listbox"], [aria-modal="true"]') : null; if (portaled && !portaled.contains(triggerEl)) return; event.preventDefault();