fix: Prevent modal from closing on text select. (#3127)

This commit is contained in:
Adam Ackerman
2025-07-03 12:46:36 -04:00
committed by GitHub
parent 07eb95be9c
commit fd0f3bc81d
+2 -1
View File
@@ -28,7 +28,8 @@ export default function Modal({
if (
modalRef.current &&
!modalRef.current.contains(e.target as Node) &&
!(e.target as HTMLElement).closest('.select__menu')
!(e.target as HTMLElement).closest('.select__menu') &&
window.getSelection()?.toString().length === 0 // Ensure no text is selected
) {
onClose();
}