mirror of
https://github.com/apache/superset.git
synced 2026-06-01 21:59:26 +00:00
feat: Automatically closes the DropdownContainer when scrolling outside of the component (#22287)
This commit is contained in:
committed by
GitHub
parent
309c064cc8
commit
8cf572858c
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user