Skip to content

Commit

Permalink
[popover2] fix(Popover2): get correct click target in shadow DOM (#5909)
Browse files Browse the repository at this point in the history
Co-authored-by: Ihor Kutenskyi <ihor.kutenskyi@medeanalytics.com>
Fixes #5908
  • Loading branch information
kutensky committed Feb 1, 2023
1 parent e38a38f commit 61a0ef8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/popover2/src/popover2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,8 @@ export class Popover2<
return;
}

const eventTarget = e.target as HTMLElement;
const event = (e.nativeEvent ?? e) as Event;
const eventTarget = (event.composed ? event.composedPath()[0] : event.target) as HTMLElement;
// if click was in target, target event listener will handle things, so don't close
if (!Utils.elementIsOrContains(this.targetElement, eventTarget) || e.nativeEvent instanceof KeyboardEvent) {
this.setOpenState(false, e);
Expand Down

1 comment on commit 61a0ef8

@adidahiya
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[popover2] fix(Popover2): get correct click target in shadow DOM (#5909)

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Please sign in to comment.