From b6cd37df39c88759884439b68f54f57a86a57f0c Mon Sep 17 00:00:00 2001 From: Yusuf YILDIZ Date: Tue, 11 Jan 2022 14:41:04 +0300 Subject: [PATCH] fix: close popup inside shadow dom solution borrowed from https://github.com/react-component/select/pull/575 --- src/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index bd60336f..7dacc4bd 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -401,7 +401,13 @@ export function generateTrigger( return; } - const { target } = event; + let { target } = event; + + // get the target from composedPath if target is a shadowRoot; + if (target.shadowRoot && event.composed) { + target = (event.composedPath()[0] || target); + } + const root = this.getRootDomNode(); const popupNode = this.getPopupDomNode(); if (