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

28 views Asked by At

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 need 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 unless I set the target explicitly. Please see the attached code from the library (lines 472 & 473):

Before my changes:

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

After my changes:

If I set the new target explicitly then it triggers the event on a new target and it gets focus. For example:

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

Can someone please help me to understand this?

0

There are 0 answers