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

iOS compatibility #83

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

iOS compatibility #83

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

Comments

@johnson-bt
Copy link

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
Copy link
Contributor

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

@rodneyrehm
Copy link
Contributor

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
Copy link
Author

Rodney-

I was able to get the iOS working with the “Custom Activated Context Menu”, where you click the button. For some odd reason, I have also been able to get it to work on my full site, but I am trying to pull the code out to a sample page, and cannot get it working in a sample with the left click trigger.

Jake Johnson/ Director of Development

Direct: 402.905.2506 ext. 1014 / Fax: 866.889.4701

Toll Free: 877.309.0368 / Hours: M-F 8 AM-5:00 PM CST

http://buildertrend.com/ Description: Description: Description: Description: Description: cid:[email protected]

11011 Q Street Ste 101B

  Omaha, Nebraska 68137

http://www.buildertrend.com/ www.buildertrend.com

http://www.facebook.com/buildertrend Description: Description: Description: Description: Description: cid:[email protected]

http://twitter.com/#!/BuilderTREND Description: Description: Description: Description: Description: cid:[email protected]

<https://market.android.com/search?q=BuilderTREND> Description: Description: Description: Description: Description: cid:[email protected]       <http://itunes.apple.com/us/app/buildertrend/id504370616?ls=1&mt=8> Description: Description: Description: Description: cid:[email protected]

From: Rodney Rehm [mailto:[email protected]]
Sent: Friday, November 02, 2012 2:22 AM
To: medialize/jQuery-contextMenu
Cc: johnson-bt
Subject: Re: [jQuery-contextMenu] iOS compatibility (#83)

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…


Reply to this email directly or view it on GitHub #83 (comment) .

https://github.com/notifications/beacon/J6T91GIPIyhU-8ti4GCGP7Wrc77YnBBYFve2jLBeZyuCk7M7f0zCIBlAPGvmZt3v.gif

@johnson-bt
Copy link
Author

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
Copy link

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
Copy link
Contributor

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
Copy link

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

@johnson-bt
Copy link
Author

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
Copy link
Contributor

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

@rodneyrehm
Copy link
Contributor

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
Copy link

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

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

All good.

@rodneyrehm
Copy link
Contributor

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

@johnson-bt
Copy link
Author

great fix. thank you guys!

@rodneyrehm rodneyrehm reopened this Dec 6, 2012
@rodneyrehm
Copy link
Contributor

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

@cobybrynte
Copy link

Glad it helped. :)

@pjanik
Copy link

pjanik commented May 31, 2013

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
Copy link
Contributor

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
Labels
Projects
None yet
Development

No branches or pull requests

6 participants