Skip to content
New issue

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

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

Already on GitHub? # to your account

Accesskey jQuery Modal Dialog not working #506

Closed
CiTRO33 opened this issue Feb 27, 2017 · 8 comments
Closed

Accesskey jQuery Modal Dialog not working #506

CiTRO33 opened this issue Feb 27, 2017 · 8 comments
Labels

Comments

@CiTRO33
Copy link

CiTRO33 commented Feb 27, 2017

Hello,

i upgraded to the latest Version of contextmenu.
With the new Version the accesskeys didn't work anymore in modal jQuery Dialogs
I created a demo to show the problem:
https://jsfiddle.net/t31wtnny/
The contextmenu can be triggered with right click on"test".

i figured it out that Linie 552 cause the problem:
getZIndexOfTriggerTarget(e.target);
// If targetZIndex is heigher then opt.zIndex dont progress any futher.
// This is used to make sure that if you are using a dialog with a input / textarea / contenteditable div
// and its above the contextmenu it wont steal keys events
if (targetZIndex > opt.zIndex) { return; }

@bbrala
Copy link
Member

bbrala commented Feb 27, 2017

When i open the demo i do get an alert, am i missing something?

@CiTRO33
Copy link
Author

CiTRO33 commented Feb 27, 2017

Hey,
i updated the fiddle https://jsfiddle.net/t31wtnny/1/ i think because of mixed content loading (http/https) something didn't worked correct.
It should look like:
grafik

the alert isnt comming if i use the accesskey "o" to open the "overview"-menu item.

If you change modal: true to modal: false the accesskey is working

@bbrala
Copy link
Member

bbrala commented Mar 1, 2017

Ah i can reproduce the problem now. Thanks

@CiTRO33
Copy link
Author

CiTRO33 commented Mar 23, 2017

Hey @bbrala
did you had some time to look into this problem?

@bbrala
Copy link
Member

bbrala commented Mar 25, 2017

Hmm, i've looked at the problem, and i think the fact you use modal:true you block the interaction with everything else through the modal dialog. From the documnetation:

If set to true, the dialog will have modal behavior; other items on the page will be disabled, i.e., cannot be interacted with. Modal dialogs create an overlay below the dialog but above other page elements.

I don't think i can really fix that.

@CiTRO33
Copy link
Author

CiTRO33 commented Mar 25, 2017

i think the problem come with the pull #335

I debugged into the fiddle https://jsfiddle.net/t31wtnny/1/

image

So the zIndex of the Dialog is behind (101) the contextMenu (102).
(This could be, because the contextMenu is build on the fly via the build function)
But in the check ( Line 552) on the zIndex the opt.zIndex is used.

If i understand the zIndex option http://swisnl.github.io/jQuery-contextMenu/docs.html#zindex correctly
this is only an offset that will be added on creation of the contextmenu.

Maybe this change on line 552 could fix the problem:
if (opt.$menu && parseInt(targetZIndex,10) > parseInt(opt.$menu.css("zIndex"),10) ) { return; }

But i dont know if this break the the pull #335

I also tried this method: https://api.jqueryui.com/dialog/#method-_allowInteraction
but also here the line 552 stops the accesskey to work.

Maybe you can use this information to find a solution.
Thanks!

@bbrala
Copy link
Member

bbrala commented Mar 25, 2017

Hmm, thanks for looking a little deeper for a possible explaination. It sounds quite reasonable... I'll have to test a bit to see if it is indeed an error in logic regarding the zIndex.

@CiTRO33
Copy link
Author

CiTRO33 commented Apr 22, 2017

Hey @bbrala,
did you had some time to test this?

bbrala added a commit that referenced this issue Apr 24, 2017
Fixes issue #506 by being a little more conservative in the zIndex check

* Update changelog
@bbrala bbrala closed this as completed May 5, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants