victor HF staff commited on
Commit
999407a
1 Parent(s): 2ce726f

Modals: dont close if text is selected (#943)

Browse files
src/lib/components/Modal.svelte CHANGED
@@ -21,6 +21,9 @@
21
  }
22
 
23
  function handleBackdropClick(event: MouseEvent) {
 
 
 
24
  if (event.target === backdropEl) {
25
  dispatch("close");
26
  }
 
21
  }
22
 
23
  function handleBackdropClick(event: MouseEvent) {
24
+ if (window?.getSelection()?.toString()) {
25
+ return;
26
+ }
27
  if (event.target === backdropEl) {
28
  dispatch("close");
29
  }
src/routes/settings/+layout.svelte CHANGED
@@ -26,6 +26,9 @@
26
  in:fly={{ y: 100 }}
27
  open
28
  use:clickOutside={() => {
 
 
 
29
  goto(previousPage);
30
  }}
31
  class="h-[95dvh] w-[90dvw] overflow-hidden rounded-2xl bg-white shadow-2xl outline-none sm:h-[80dvh] xl:w-[1200px] 2xl:h-[70dvh]"
 
26
  in:fly={{ y: 100 }}
27
  open
28
  use:clickOutside={() => {
29
+ if (window?.getSelection()?.toString()) {
30
+ return;
31
+ }
32
  goto(previousPage);
33
  }}
34
  class="h-[95dvh] w-[90dvw] overflow-hidden rounded-2xl bg-white shadow-2xl outline-none sm:h-[80dvh] xl:w-[1200px] 2xl:h-[70dvh]"