Skip to content

Commit

Permalink
fix(Popover): doc click event
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcfaul committed Jan 10, 2024
1 parent 20f2bd7 commit b22a29b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/react-core/src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
};
const onDocumentClick = (event: MouseEvent, triggerElement: HTMLElement, popperElement: HTMLElement) => {
if (hideOnOutsideClick && visible) {
// check if we clicked within the popper, if so don't do anything
const isChild = popperElement && popperElement.contains(event.target as Node);
if (isChild) {
// clicked within the popper
const isFromChild = popperElement && popperElement.contains(event.target as Node);
const isFromTrigger = triggerElement && triggerElement.contains(event.target as Node);
if (isFromChild || isFromTrigger) {
// if clicked within the popper or on the trigger, ignore this event
return;
}
if (triggerManually) {
Expand Down

0 comments on commit b22a29b

Please sign in to comment.