swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill

Home Page:https://swisnl.github.io/jQuery-contextMenu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS compatibility

johnson-bt opened this issue · comments

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…

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:image001.png@01CCF208.D37EBB60

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:image002.jpg@01CCF208.D37EBB60

http://twitter.com/#!/BuilderTREND Description: Description: Description: Description: Description: cid:image003.jpg@01CCF208.D37EBB60

<https://market.android.com/search?q=BuilderTREND> Description: Description: Description: Description: Description: cid:image004.jpg@01CCF208.D37EBB60       <http://itunes.apple.com/us/app/buildertrend/id504370616?ls=1&mt=8> Description: Description: Description: Description: cid:image005.jpg@01CD05E9.EA8165C0

From: Rodney Rehm [mailto:notifications@github.com]
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

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.

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

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.

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.

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

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!

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

Glad it helped. :)

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?

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).