Skip to content

Commit b6cd37d

Browse files
authored
fix: close popup inside shadow dom
solution borrowed from react-component/select#575
1 parent 92793b4 commit b6cd37d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,13 @@ export function generateTrigger(
401401
return;
402402
}
403403

404-
const { target } = event;
404+
let { target } = event;
405+
406+
// get the target from composedPath if target is a shadowRoot;
407+
if (target.shadowRoot && event.composed) {
408+
target = (event.composedPath()[0] || target);
409+
}
410+
405411
const root = this.getRootDomNode();
406412
const popupNode = this.getPopupDomNode();
407413
if (

0 commit comments

Comments
 (0)