mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-24 03:55:49 -05:00
Fix modal closing on Firefox when clicking select Closes #1790
This commit is contained in:
@@ -22,6 +22,11 @@ export function Dialog({
|
||||
? (event: React.MouseEvent<HTMLDialogElement, 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 &&
|
||||
|
||||
Reference in New Issue
Block a user