iOS compatibility #83

johnson-bt opened this Issue Oct 31, 2012 · 17 comments

6 participants


I have plugged the contextMenu into my site and I am trying to use it on the iPad. It is opening just fine, but when I click on an item, the callback method is not firing.

Do you have any suggestions?


I have never tried the context menu on a touch device. I'll look into it.


I'm wondering how you got the menu to show. contextMenu itself doesn't know about touch events and the demos won't show a menu…



Without having to do the button click example, you can get the menu to open on iOS, by attaching the contextMenu to a selector on a html anchor control such as:

    <a href="javascript:alert('test');" class="liUsesContextMenu" ID="hrefOpenDocLink" >click this link</a>

Where the liUsesContextMenu is the selector that you use. In that case, the context menu will appear and open on the iOS, it just doesn't respond to the click event.


hi Rodney,
i m getting contextmenu open in ipad/iphone (safaribrowser) on button tap
(given contextmenu trigger property as leftclick ),facing problem on taping menuitem
(not firing callback method)
please help me


Without having tested this theory, I figure the menu-item won't trigger, because it isn't selected (as there is neither hover, nor keyboard input). I'm aware of the problem but haven't investigated yet.


Hey. Has anyone had any success with a workaround for this issue? Thanks



I have not came up with a workaround. iOS support is a big deal for us, so I am keeping an eye out on this as well.


I won't be able to look into this before Christmas. If anyone has ideas (even if they can't test themselves), shoot!


I just got this via mail:

I found a minor bug for this contextmenu running on Safari Mobile browser. Basically, the itemclick event is not triggered. It is most likely due to the following issue.

Mobile Safari will only produce mouse events when the user taps on a clickable element, like a link. You can make an element clickable by adding an onClick event handler to it, even if that handler does nothing.

I made the following changes on line 939.

var $t = $('<li class="context-menu-item ' + (item.className || "") +'" onClick="javascript:void(0);"></li>'),

It is working fine now on Safari mobile. Hope this helps.

Thanks again for your attention.

Brian Zhang


Thanks Rodney and Brian. Excellent fix.
@johnson-bt, go for it.

I'm on V1.5.25.
I replaced line 937:

All good.


so binding a void click event already does the job? sweet.


great fix. thank you guys!

@johnson-bt johnson-bt closed this Dec 6, 2012
@rodneyrehm rodneyrehm reopened this Dec 6, 2012

This issue is not closed. I haven't resolved it in the actual contextMenu yet!


Glad it helped. :)

@rodneyrehm rodneyrehm closed this Dec 29, 2012

Hm, I'm testing this site:
on iPad simulator and it doesn't work for me. Menu doesn't show up on tap. I have the same problem in real-life application and real iPads. ;)

Is this some regression? Does this page work for you?


Well, it's essentially the same issue. I added a dummy handler onclick="void('iOS need this');" to the demo (in branch master - this is not yet live on gh-pages).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment