Skip to content

Commit

Permalink
feat: Automatically closes the DropdownContainer when scrolling outsi…
Browse files Browse the repository at this point in the history
…de of the component (#22287)
  • Loading branch information
michael-s-molina authored Dec 1, 2022
1 parent 309c064 commit 8cf5728
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions superset-frontend/src/components/DropdownContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ const DropdownContainer = forwardRef(
[ref],
);

// Closes the popover when scrolling on the document
useEffect(() => {
document.onscroll = popoverVisible
? () => setPopoverVisible(false)
: null;
return () => {
document.onscroll = null;
};
}, [popoverVisible]);

return (
<div
ref={ref}
Expand Down

0 comments on commit 8cf5728

Please sign in to comment.