-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More than one menu showup, how to disappear it automatic? #1025
Comments
Hi @kyle-go , thanks for raising this issue. The bug is due to checking Will be fixing it in the upcoming release. |
Fixed by v4.0.3. In addition to the new version, we need to make sure open context menu only if the browser tab is in foreground: onContextMenu: (e) => {
e.preventDefault();
if (!document.hasFocus()) return;
setAnchorRef(null);
setAnchorPoint({ x: e.clientX, y: e.clientY });
toggleMenu(true);
} |
Thanks for your update new version. It can disappear even if document is not in focus. any way, It's better than before, Thanks so much! Greate job |
Is there any way to keep the standard behavior that right-click focuses the document? The suggested code above ignores them. Thank |
hey @JonathanMEdwards, you could remove the checking for document focus I think the setup in the CodeSandbox Link is a middle ground solution without introducing an undesired bug. This is due to how focus management is implemented in this library. We're still able to navigate through menu items using keyboard even in a context menu. |
React/React-dom version:
React-Menu version:
4.0.2
Describe the bug
If the browser lose focus, right click the clickable area, will show two menus.
To Reproduce
Expected behavior
Show only one menu.
Code snippets/CodeSandbox examples/Screenshots
https://codesandbox.io/s/usecontrolledmenu-forked-yxndtd
picuture:
The text was updated successfully, but these errors were encountered: