Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening a second menu can break the "layer". #105

Closed
lmonilsson opened this issue Jan 20, 2013 · 13 comments
Closed

Opening a second menu can break the "layer". #105

lmonilsson opened this issue Jan 20, 2013 · 13 comments

Comments

@lmonilsson
Copy link

I am testing the demo at http://medialize.github.com/jQuery-contextMenu/demo/on-dom-element.html, and have encountered an issue.

  1. Right-click on one of the items.
  2. Right-click on a different item.

The first menu closes, and the second menu pops up, but only for a moment. After that, nothing on the page can be clicked. When clicking anywhere at this stage, the error log in Firefox says:

Error: TypeError: root.$layer is undefined Source File: http://medialize.github.com/jQuery-contextMenu/src/jquery.contextMenu.js Line: 362

@rodneyrehm
Copy link
Contributor

thank you for reporting that - it's fixed…

@aamirobs
Copy link

Hi,
i download the latest and still its giving me error.

TypeError: root.$layer is undefined
root.$layer.hide();

@rodneyrehm
Copy link
Contributor

I am not getting that error anymore. What browser are you using? http://medialize.github.com/jQuery-contextMenu/demo/on-dom-element.html works for me…

@aamirobs
Copy link

Hi please look at this script i just create for you.
load the page by clicking left side links more than 2-3 times.
http://hddezign.com/contextMenu/

@rodneyrehm
Copy link
Contributor

$ curl 'http://hddezign.com/contextMenu/' --connect-timeout 3
curl: (6) name lookup timed out

can't open that link…

@aamirobs
Copy link

http://hddezign.com/contextMenu/
open it in browser. then load different plans 3-5 times and move your mouse over days and you will see the error.

@aamirobs
Copy link

you can download the code here:
http://orientbsol.com/Hostings/contextMenu.zip

@rodneyrehm
Copy link
Contributor

You should seriously reconsider your approach… Don't have your POST request return a <script> that never changes… Apply that once, in the main document. Use delegated events. instead of $('#add-plan-trigger-days').on('click', function(e) { do $(document).on('click', '#add-plan-trigger-days', function(e) {and the event handler will still apply even after your content was switched after that ajax request. contextMenu already uses delegated events, so you do not need to re-initialize it every time.

@rodneyrehm
Copy link
Contributor

(I applied that change to your code and it worked for me)

But you did find a bug: #110

@robertoea
Copy link

I can reliably reproduce the issue on this very page: http://medialize.github.com/jQuery-contextMenu/demo/on-dom-element.html by right-clicking rapidly (or not so rapidly on slower machine/when the CPU usage is high) multiple times.

I would suggest adding checks to ensure that the $layer is defined before calling the hide().

@rafczy
Copy link

rafczy commented Dec 31, 2013

Issue can be reproduced, like robertoea wrote.
It is easy to reproduce by making circles when right clicking fast.
The problem lies in:

[...]
 // find the element that would've been clicked, wasn't the layer in the way
if (document.elementFromPoint) {
root.$layer.hide(); // <-- here, line 367
[...]

Could You verify it, please?

@ulao
Copy link

ulao commented Apr 15, 2014

Can anyone help with this bug. I get the same error if I click out of term.

also I keep seeing this
TypeError: Argument 1 of Document.elementFromPoint is not a finite floating-point value.

@Pancakeo
Copy link

Was able to reproduce this as well. For the 'finite' error, something like this helps: https://gist.github.com/Lajnold/5404556

Of course, the $root.layer problem is on that path and will still occur.

I'll try and create a patch for this, which may involve having to read the source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants