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

Context menu doesn't close when stopPropagation() is called on a click event. #34

Open
Timmeeeey opened this issue Dec 18, 2023 · 3 comments

Comments

@Timmeeeey
Copy link

Describe the bug
When you open a context menu and click somewhere where stopPropagation() is called on the click event, then the context menu doesn't close.

To Reproduce
Steps to reproduce the behavior:

  1. Open context menu.
  2. Click on the blue area.

Expected behavior
The context menu should always close when clicking outside the menu.

Stackblitz Example
https://stackblitz.com/edit/ngx-contextmenu-example-zas2j8

2023-12-18_15h49_51

@sroucheray
Copy link
Member

Hi @Timmeeeey, I just saw your issue, sorry for the delay. Unfortunately, there is little I can do. To close the menu I listen to "document:click", if the event is stopped it never reach the document, thus prevent menu closing. Do you see any workaround ?

@Timmeeeey
Copy link
Author

Hi @sroucheray
Unfortunately, I don't see any good alternative. You could use a backdrop to close the menu on outside click but this causes other issues, for example with submenus.
The issue I have is with a dialog component of a UI framework I use which catches click events and calls stopPropagation().
I guess I have to wait and hope that they are fixing this.

@sroucheray
Copy link
Member

Backdrop is not a bad idea, though.

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