Skip to content

Commit

Permalink
Fix report action context menu stuck when open search page with keybo…
Browse files Browse the repository at this point in the history
…ard shortcut

Signed-off-by: Tsaqif <[email protected]>
  • Loading branch information
tsa321 committed Oct 10, 2023
1 parent b2d1c6f commit c58c53e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/PopoverProvider/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';

const propTypes = {
children: PropTypes.node.isRequired,
Expand All @@ -22,7 +23,9 @@ function PopoverContextProvider(props) {
if (!activePopoverRef.current || (anchorRef && anchorRef !== activePopoverRef.current.anchorRef)) {
return;
}

activePopoverRef.current.close();
lodashGet(activePopoverRef, 'current.onCloseCallback', () => {})();
activePopoverRef.current = null;
setIsOpen(false);
}, []);
Expand Down Expand Up @@ -106,6 +109,7 @@ function PopoverContextProvider(props) {
closePopover(activePopoverRef.current.anchorRef);
}
activePopoverRef.current = popoverParams;
lodashGet(activePopoverRef, 'current.onOpenCallback', () => {})();
setIsOpen(true);
},
[closePopover],
Expand Down
3 changes: 2 additions & 1 deletion src/components/PopoverWithoutOverlay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function Popover(props) {
ref: props.withoutOverlayRef,
close: props.onClose,
anchorRef: props.anchorRef,
onCloseCallback: () => Modal.setCloseModal(null),
onOpenCallback: () => Modal.setCloseModal(() => props.onClose(props.anchorRef)),
});
} else {
props.onModalHide();
Expand All @@ -48,7 +50,6 @@ function Popover(props) {
return;
}
firstRenderRef.current = false;
Modal.setCloseModal(props.isVisible ? () => props.onClose(props.anchorRef) : null);

// We want this effect to run strictly ONLY when isVisible prop changes
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit c58c53e

Please sign in to comment.