From bab2b1849a1162c91a4d9d46aa0b79b2fbf4b720 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:17:58 +0300 Subject: [PATCH] Fix modal closing on Firefox when clicking select Closes #1790 --- app/components/Dialog.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/components/Dialog.tsx b/app/components/Dialog.tsx index f7f12c367..081f30fbe 100644 --- a/app/components/Dialog.tsx +++ b/app/components/Dialog.tsx @@ -22,6 +22,11 @@ export function Dialog({ ? (event: React.MouseEvent) => { if (closeOnAnyClick) return close(); const rect: DOMRect = ref.current.getBoundingClientRect(); + + // https://stackoverflow.com/a/77402711 + const isFirefoxSelectClick = event.clientY === 0 && event.clientX === 0; + if (isFirefoxSelectClick) return; + const isInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height &&