Doist / reactist

Open source React components made with ❤️ by Doist
http://doist.github.io/reactist
MIT License
248 stars 22 forks source link

[Menu] Using a ContextMenuTrigger stops the MenuButton from setting an anchor position correctly #761

Closed frankieyan closed 1 year ago

frankieyan commented 1 year ago

🐛 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, 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.