Fix deploy modal closing when opening the map dropdown
The bounding-rect click-outside check treated native <select> option clicks (which render below the dialog) as backdrop clicks. Switch to the standard e.target === dialog check — only clicks on the dialog element itself close. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -59,14 +59,12 @@
|
||||
open = false;
|
||||
}
|
||||
|
||||
// Click-outside-to-close (native <dialog> only supports Esc).
|
||||
// Click-outside-to-close (native <dialog> only supports Esc). Only treat
|
||||
// clicks whose target is the dialog element itself (the backdrop) as
|
||||
// outside — a bounding-rect check catches native <select> dropdown
|
||||
// options that render below the modal and closes the whole thing.
|
||||
function onDialogClick(e: MouseEvent): void {
|
||||
if (!dialog) return;
|
||||
const rect = dialog.getBoundingClientRect();
|
||||
const inDialog =
|
||||
e.clientX >= rect.left && e.clientX <= rect.right &&
|
||||
e.clientY >= rect.top && e.clientY <= rect.bottom;
|
||||
if (!inDialog) close();
|
||||
if (e.target === dialog) close();
|
||||
}
|
||||
|
||||
let selectedMap = $derived(maps.find((m) => m.slug === mapSlug));
|
||||
|
||||
Reference in New Issue
Block a user