Skip to content

Commit

Permalink
fix: Reset anchor rect after context menu is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
gnapse committed Mar 8, 2024
1 parent c95df9a commit 130ccf4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
})

Expand Down

0 comments on commit 130ccf4

Please sign in to comment.