jQuery-contextMenu
jQuery-contextMenu copied to clipboard
Opening context menu twice throws exception
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.
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!
the url you provided throws a 404 :( @nico0756
Sorry, I edited the link and now it works
If I read the code correctly sometimes the event doesn't send a pageX when triggered?
That should be easy to fix.
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 @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
I forgot to mention this ticket, sorry.
Has been fixed in master. :)
https://github.com/swisnl/jQuery-contextMenu/commit/e94897ed9543e34dc5a9db94e27ead049de882a4