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

Jquery-contextMenu does not trigger the event on the new target element #771

Open
H-GhaziSultan opened this issue Dec 18, 2023 · 0 comments

Comments

@H-GhaziSultan
Copy link

H-GhaziSultan commented Dec 18, 2023

I am using the jQuery contextMenu library v2.9.2. I want to close the context menu by clicking outside the context-menu div but I also want to focus on the element where I just clicked (new target).

I know jQuery contextMenu has a hidden layer and that layer has a handler "layerClick" which hides the context menu and also gets the new target element inside this handler. But the problem is jQuery trigger method does not trigger the event on a new target element because the event points to the hidden layer (id="context-menu-layer"). Please see the attached code from the library (line no 472 & 473):

Before my changes:
$(target).trigger(e);
root.$layer.show();

After my changes:
I need to set the new target explicitly then it triggers the event on a new target and it gets focus.

e.target = target;
$(target).trigger(e);
root.$layer.show();

It seems like it is a bug in jQuery-contextMenu. Please correct me if I am wrong.

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

1 participant