fix(ui): allow multiple detail views open across AppPages

Previously, clicking a detail view in one AppPage would close the
overlay in all other AppPages because the global click handler closed
on ANY click outside the overlay card.

Now the click handler only closes the overlay when the click is
inside the SAME AppPage but outside the overlay card. Clicks in
other AppPages are ignored, allowing multiple detail views to be
open simultaneously side by side.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-03 13:48:25 +02:00
parent df74029423
commit a8480f6710

View file

@ -216,12 +216,20 @@
}
let overlayCardEl = $state<HTMLDivElement | null>(null);
let appPageEl = $state<HTMLDivElement | null>(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 @@
</script>
<div
bind:this={appPageEl}
class="app-page-wrapper"
use:dropTarget={{
accepts: acceptedDropTypes,