Skip to content

Commit b22a29b

Browse files
committed
fix(Popover): doc click event
1 parent 20f2bd7 commit b22a29b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/react-core/src/components/Popover/Popover.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,10 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
334334
};
335335
const onDocumentClick = (event: MouseEvent, triggerElement: HTMLElement, popperElement: HTMLElement) => {
336336
if (hideOnOutsideClick && visible) {
337-
// check if we clicked within the popper, if so don't do anything
338-
const isChild = popperElement && popperElement.contains(event.target as Node);
339-
if (isChild) {
340-
// clicked within the popper
337+
const isFromChild = popperElement && popperElement.contains(event.target as Node);
338+
const isFromTrigger = triggerElement && triggerElement.contains(event.target as Node);
339+
if (isFromChild || isFromTrigger) {
340+
// if clicked within the popper or on the trigger, ignore this event
341341
return;
342342
}
343343
if (triggerManually) {

0 commit comments

Comments
 (0)