jQuery-contextMenu icon indicating copy to clipboard operation
jQuery-contextMenu copied to clipboard

Opening context menu twice throws exception

Open omer-sds opened this issue 8 years ago • 7 comments

i am using the latest version for the context menu 2.5.0 and if i try to open the menu if it is already opened it throws error in the console

TypeError: Argument 1 of Document.elementFromPoint is not a finite floating-point value. context.menu.js Line 459

which points to the following line of code inside the layerClick function

target = document.elementFromPoint(x - $win.scrollLeft(), y - $win.scrollTop());

that selects the target element to be clicked

i am creating a file manager plugin for tinymce and i am using this context menu inside the modal window i am using 2 instances of the context menu on the thumbnails and on the background for the thumbnails i initialize the cut copy delete and quit menu items and for the background i initialize menu with paste and quit only now if i open the context menu on the thumbnail to copy and try to click right click on the background to paste it throws the above error any idea what could be the problem although it opens the menu but if you keep doing this after 4, 5 tries it stops propagating the menu and the behavior is random for the items / thumbnails, on clicking some thumbnails it will open and for others it wont.

omer-sds avatar Sep 14 '17 02:09 omer-sds

I've had this same problem, which should have been fixed years ago. Luckily I found a patch someone made years ago: https://gist.github.com/Lajnold/5404556

Good luck!

nico0756 avatar Dec 23 '17 13:12 nico0756

the url you provided throws a 404 :( @nico0756

buttflattery avatar Dec 23 '17 13:12 buttflattery

Sorry, I edited the link and now it works

nico0756 avatar Dec 23 '17 15:12 nico0756

If I read the code correctly sometimes the event doesn't send a pageX when triggered?

That should be easy to fix.

bbrala avatar Dec 23 '17 15:12 bbrala

Bump, do you have any news about when it's going to be fixed ? Or is it low priority and it's not going to be fixed anytime soon ?

PierreCapo avatar Feb 15 '18 10:02 PierreCapo

@PierreCapo @bbrala you can add the changes from this merge https://gist.github.com/Lajnold/5404556 manually the author seems to be dead May he rest in peace

buttflattery avatar Feb 27 '18 20:02 buttflattery

I forgot to mention this ticket, sorry.

Has been fixed in master. :)

https://github.com/swisnl/jQuery-contextMenu/commit/e94897ed9543e34dc5a9db94e27ead049de882a4

bbrala avatar Feb 28 '18 15:02 bbrala