Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

iOS compatibility #83

Closed
johnson-bt opened this Issue · 17 comments

6 participants

@johnson-bt

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?

@rodneyrehm
Owner

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

@rodneyrehm
Owner

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…

@johnson-bt
@johnson-bt

Rodney-

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.

@kiran112

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

@rodneyrehm
Owner

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.

@supermild

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

@johnson-bt

supermild-

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.

@rodneyrehm
Owner

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

@rodneyrehm
Owner

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.

http://sitr.us/2011/07/28/how-mobile-safari-emulates-mouse-events.html

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.

Sincerely,
Brian Zhang

@supermild

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

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

All good.

@rodneyrehm
Owner

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

@johnson-bt

great fix. thank you guys!

@johnson-bt johnson-bt closed this
@rodneyrehm rodneyrehm reopened this
@rodneyrehm
Owner

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

@cobybrynte

Glad it helped. :)

@rodneyrehm rodneyrehm closed this
@pjanik

Hm, I'm testing this site:
http://medialize.github.io/jQuery-contextMenu/demo/trigger-left-click.html
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?

@rodneyrehm
Owner

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
Something went wrong with that request. Please try again.