swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.24k stars 744 forks source link

Layer passthrough event has wrong .target #631

Open corwin-of-amber opened 6 years ago

corwin-of-amber commented 6 years ago

To allow closing the menu when clicking outside, jQuery-contextMenu puts a helper layer on top of the document. When it's clicked, jQuery-contextMenu cleverly sends the mouse event to the element right beneath it to mimic what would happen if the layer was not there. This may address some of the concerns raised by #532.

One flaw, though, is that the 'target' property of the event is the layer, not the delegated element. This can easily be fixed by adding e.target = target here. (Not making a push request since the change is so small.)

I tried changing e.originalEvent.target as well, but unfortunately it had no effect.

bbrala commented 6 years ago

Seems sensible, i'll have a look.