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

Previous opened context menu are not closed and context menu value is not properly updated #39

Open
lazaro3487 opened this issue Jan 3, 2025 · 2 comments

Comments

@lazaro3487
Copy link

Describe the bug
I am trying to create a dynamic context menu component who receives the list of context menu actions. For this purpose I am using the wrapper by delegating its behavior over ContextMenuService, however the previously opened menus are not closed.
Another strange behavior I notice is the fact that the context menu value is not properly refreshed. The previous value is passed within the visible and disabled context menu operations.

Your help could be very appreciated.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://stackblitz.com/~/github.com/lazaro3487/angular-context-menu'
  2. Right click on the table cells. The previous context menu is not closed.
  3. On the browser developer tools the value for visible and disabled functions are logged, to see the problem.

Stackblitz Example
https://stackblitz.com/~/github.com/lazaro3487/angular-context-menu

@sroucheray
Copy link
Member

Hi @lazaro3487,

I took a little time to fix your code. The use of the ContextMenuService is low level, hence it does not close automatically previously opened menus.

https://github.com/lazaro3487/angular-context-menu/pull/1/files

@lazaro3487
Copy link
Author

Hello, thank you very much for taking the time to look at it.
It also happens the fist time the context menu is opened, the value passed to the visible function is OK, but the one passed to "disabled" keeps the value from the previous opened context menu. You have to even move the cursor over the menu for this to get refreshed / updated. You can check this behavior because the values are logged to the console.

Is this behavior a bug?

Many thanks in advance.

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