diff --git a/src/components/ui/ListItem.tsx b/src/components/ui/ListItem.tsx index 9577d7efc..c3c0e050d 100644 --- a/src/components/ui/ListItem.tsx +++ b/src/components/ui/ListItem.tsx @@ -104,8 +104,9 @@ const ListItem: FC = ({ ); const getMenuElement = useCallback( - () => containerRef.current!.querySelector('.ListItem-context-menu .bubble'), - [], + () => (withPortalForMenu ? document.querySelector('#portals') : containerRef.current)! + .querySelector('.ListItem-context-menu .bubble'), + [withPortalForMenu], ); const getLayout = useCallback(