Skip to content
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

Disabling a menu item prevents menu from closing #264

Open
johnw42 opened this issue Apr 9, 2024 · 1 comment
Open

Disabling a menu item prevents menu from closing #264

johnw42 opened this issue Apr 9, 2024 · 1 comment

Comments

@johnw42
Copy link

johnw42 commented Apr 9, 2024

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

If clicking a menu item disables an item in the menu, the menu remains on the screen.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

https://codesandbox.io/p/sandbox/crimson-thunder-crwcng

I can't figure out the error I'm seeing in the preview, but when I run the code locally it runs fine and demonstrates the problem when you decrement the counter to 0.

What is the expected behavior?

The menu should disappear as usual.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Edge Version 123.0.2420.81 (Official build) (64-bit)
Windows 11

"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-scripts": "^5.0.0",
"react-contexify": "6.0.0"

I don't know of a React version where it works.

@matsales28
Copy link

I'm facing the same problem. I had to hide the Menu manually using the MENU_ID value and the hide_all function from useContextMenu

  const { hideAll } = useContextMenu({
    id: MENU_ID,
  });

  onItemClickCallback = () => {
    ### my logic here

    hideAll();
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants