Skip to content

Instantly share code, notes, and snippets.

@lmonilsson
Last active December 23, 2017 13:50
Show Gist options
  • Save lmonilsson/5404556 to your computer and use it in GitHub Desktop.
Save lmonilsson/5404556 to your computer and use it in GitHub Desktop.
Patch proposal for https://github.com/medialize/jQuery-contextMenu/issues/132 It wraps a bunch of layerClick() code inside a "!fakeClick" condition.
Index: jquery.contextMenu.js
===================================================================
--- jquery.contextMenu.js (revision 6957)
+++ jquery.contextMenu.js (working copy)
@@ -351,6 +351,7 @@
button = e.button,
x = e.pageX,
y = e.pageY,
+ fakeClick = x === undefined,
target,
offset,
selectors;
@@ -359,6 +360,7 @@
e.stopImmediatePropagation();
setTimeout(function() {
+ if (!fakeClick) {
var $window, hideshow, possibleTarget;
var triggerAction = ((root.trigger == 'left' && button === 0) || (root.trigger == 'right' && button === 2));
@@ -403,6 +405,7 @@
$(target).contextMenu({x: x, y: y});
});
}
+ }
root.$menu.trigger('contextmenu:hide');
}, 50);
@nico0756
Copy link

It's been like 4 years since you posted this and the error still exist. Thanks for the patch, you saved me hours, if not days, of work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment