From 956b7383bd1e9f0f7c8fb29bf159375464917bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Oldag?= Date: Tue, 28 May 2024 13:31:04 +0200 Subject: [PATCH] Fix auto-closing if used in open shadow DOM --- src/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index a65dcc6e..1d5bda7c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -216,8 +216,8 @@ class SemanticDatepicker extends React.Component< mousedownCb = (mousedownEvent) => { const { isVisible } = this.state; - if (isVisible && this.el) { - if (this.el.current && !this.el.current.contains(mousedownEvent.target)) { + if (isVisible && this.el && this.el.) { + if (this.el.current && !this.el.current.contains(mousedownEvent.composedPath()[0])) { this.close(); } }