diff --git a/src/menu/menu.tsx b/src/menu/menu.tsx index ca964c846..db9a87f95 100644 --- a/src/menu/menu.tsx +++ b/src/menu/menu.tsx @@ -126,6 +126,11 @@ const ContextMenuTrigger = polymorphicComponent<'div', unknown>(function Context [setAnchorRect, menuStore], ) + const isOpen = menuStore.useState('open') + React.useEffect(() => { + if (!isOpen) setAnchorRect(null) + }, [isOpen, setAnchorRect]) + return React.createElement(component, { ...props, onContextMenu: handleContextMenu, ref }) })