From 0f319ed8a05b41842fe82427769dc77df7b38d37 Mon Sep 17 00:00:00 2001 From: feralonsomaccari Date: Fri, 13 Sep 2019 11:54:59 -0300 Subject: [PATCH] hotfix fast right click between two or more buttons --- src/jquery.contextMenu.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/jquery.contextMenu.js b/src/jquery.contextMenu.js index c4a642e9..af0efb61 100644 --- a/src/jquery.contextMenu.js +++ b/src/jquery.contextMenu.js @@ -442,6 +442,9 @@ e.preventDefault(); + // If you click it very fast beetwen two or more buttons the layer get bugged + removeContextMenuLayer(); + setTimeout(function () { // If the click is not real, things break: https://github.com/swisnl/jQuery-contextMenu/issues/132 if(fakeClick){ @@ -2126,3 +2129,13 @@ $.contextMenu.op = op; $.contextMenu.menus = menus; }); + + +// If you click too fast beetwen two or more buttons, the layer on top of the everything stay bugged. +// Calling this function solve the problem removing the layer +// You can try fast right clicking multiple times here https://swisnl.github.io/jQuery-contextMenu/demo/on-dom-element.html +function removeContextMenuLayer(){ + $('#context-menu-layer').remove(); + $('#context-menu-layer .context-menu-list').remove(); + } + \ No newline at end of file