Skip to content

Commit

Permalink
Merge pull request #27649 from ishpaul777/fix/removeDragoverListner-i…
Browse files Browse the repository at this point in the history
…n-FAB-menu

Fix remove dragover listner when popover hides
  • Loading branch information
srikarparsi authored Sep 21, 2023
2 parents 0c80655 + e837797 commit cfc4239
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pages/home/sidebar/SidebarScreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,28 @@ function SidebarScreen(props) {
}, []),
);

/**
* Method to hide popover when dragover.
*/
const hidePopoverOnDragOver = useCallback(() => {
if (!popoverModal.current) {
return;
}
popoverModal.current.hideCreateMenu();
}, []);

/**
* Method create event listener
*/
const createDragoverListener = () => {
document.addEventListener('dragover', () => popoverModal.current.hideCreateMenu());
document.addEventListener('dragover', hidePopoverOnDragOver);
};

/**
* Method remove event listener.
*/
const removeDragoverListener = () => {
document.removeEventListener('dragover', () => popoverModal.current.hideCreateMenu());
document.removeEventListener('dragover', hidePopoverOnDragOver);
};

return (
Expand Down

0 comments on commit cfc4239

Please sign in to comment.