diff --git a/apps/manacore/apps/web/src/lib/components/workbench/AppPage.svelte b/apps/manacore/apps/web/src/lib/components/workbench/AppPage.svelte index 32b60c5ab..6ac815c78 100644 --- a/apps/manacore/apps/web/src/lib/components/workbench/AppPage.svelte +++ b/apps/manacore/apps/web/src/lib/components/workbench/AppPage.svelte @@ -216,12 +216,20 @@ } let overlayCardEl = $state(null); + let appPageEl = $state(null); - // Close overlay on any click outside the overlay card + // Close overlay on click outside the overlay card BUT inside this AppPage + // (clicks in other AppPages should NOT close this overlay) $effect(() => { if (!overlay) return; function handleGlobalClick(e: MouseEvent) { - if (overlayCardEl && !overlayCardEl.contains(e.target as Node)) { + const target = e.target as Node; + if ( + overlayCardEl && + appPageEl && + appPageEl.contains(target) && + !overlayCardEl.contains(target) + ) { overlayStack = []; siblingIds = []; siblingKey = ''; @@ -238,6 +246,7 @@