Skip to content

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

Open
@H-GhaziSultan

Description

@H-GhaziSultan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions