From 3b3593bbd713f74930306ce61685efc90ba0c476 Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Mon, 13 Jun 2022 21:10:02 +0200
Subject: feat: Don't continue if no target is available on mousemove event

---
 apps/web-shared/src/components/dropdown.svelte | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'apps/web-shared/src/components/dropdown.svelte')

diff --git a/apps/web-shared/src/components/dropdown.svelte b/apps/web-shared/src/components/dropdown.svelte
index 2b7f82b..a28bcd3 100644
--- a/apps/web-shared/src/components/dropdown.svelte
+++ b/apps/web-shared/src/components/dropdown.svelte
@@ -1,7 +1,7 @@
 <script lang="ts">
     // @ts-ignore
-    import {go, highlight} from "fuzzysort";
-    import {element_has_focus, random_string} from "$shared/lib/helpers";
+    import { go, highlight } from "fuzzysort";
+    import { element_has_focus, random_string } from "$shared/lib/helpers";
     import Button from "$shared/components/button.svelte";
     import Chip from "$shared/components/chip.svelte";
 
@@ -175,6 +175,7 @@
 
     const windowEvents = {
         on_mousemove(event) {
+            if (!event.target) return;
             mouseIsOverDropdown = (event.target?.closest("#" + INTERNAL_ID + " .autocomplete__results") != null ?? false);
             mouseIsOverComponent = (event.target?.closest("#" + INTERNAL_ID) != null ?? false);
         },
-- 
cgit v1.3

