diff --git a/src/lib/datepicker/Datepicker.svelte b/src/lib/datepicker/Datepicker.svelte index a29f41ce9..1d83c756c 100644 --- a/src/lib/datepicker/Datepicker.svelte +++ b/src/lib/datepicker/Datepicker.svelte @@ -151,7 +151,7 @@ } function handleClickOutside(event: MouseEvent) { - if (isOpen && !datepickerContainerElement.contains(event.target as Node)) { + if (isOpen && datepickerContainerElement && !datepickerContainerElement.contains(event.target as Node)) { isOpen = false; } }