As we're leveraging Ariakit's getAnchorRect to change the menu's anchor position when used as a context menu, the MenuButton loses the ability to set the menu's anchor correctly when it's clicked after the menu has been triggered via right click.
Steps to reproduce the bug
With the ContextMenuTrigger story, first right click on the "Settings" button, then click on the v button to the side.
Expected behavior
The menu should be correctly anchored to the v button, even if the menu has been anchored elsewhere previously.
🐛 Bug report
Current behavior
This is best explained with a video:
https://user-images.githubusercontent.com/8531248/226491891-e35cfb3d-b4ba-44e6-84e2-fb5c5453a7c5.mov
As we're leveraging Ariakit's
getAnchorRect
to change the menu's anchor position when used as a context menu, theMenuButton
loses the ability to set the menu's anchor correctly when it's clicked after the menu has been triggered via right click.Steps to reproduce the bug
With the ContextMenuTrigger story, first right click on the "Settings" button, then click on the
v
button to the side.Expected behavior
The menu should be correctly anchored to the
v
button, even if the menu has been anchored elsewhere previously.