Holding down on text in iOS does not bring up the 'copy' button on jQueryMobile Dialog when using ajax #4322

Closed
alexboots opened this Issue May 9, 2012 · 4 comments

Projects

None yet

5 participants

@alexboots

I am talking about one of these Dialog boxes that pop up: http://jquerymobile.com/test/docs/pages/page-dialogs.html

(short url for mobile http://bit.ly/KhCGVD)

Click 'Open Dialog' -- on that dialog box, nothing is copy-able in iOS without 'data-ajax="false"' in the the link. (works fine on Android)

Putting '-webkit-user-select: auto!important;' (or 'text' instead of 'auto') does nothing.

Adding the javascript 'document.documentElement.style.webkitTouchCallout = "auto";' does nothing.

tested on 4.3.5 -- 4.3.2 -- iOS 5.1

Edit:: the issue has been answered here (what to remove to make it work)
http://stackoverflow.com/questions/10454177/holding-down-on-text-in-ios-does-not-bring-up-the-copy-button-on-jquerymobile

Problem
Problem lies quite deep in the code of this framework. First of all we have a jquery.mobile.dialog.js file in which we have a line:

$el.bind( "vclick submit", function( event ) {
           // code
        })

As you can see here we are adding a binding vclick to the $el - whole dialog box container.

Event vclick on it's own is generated by jQuery Mobile in vmouse.js and after digging there i managed to detect where actual problem arises:

$( this ).bind( realType, dummyMouseHandler );

This line is required to make event work in some browsers, namely Opera Mini (as described in commented text above this line).

Solution
So, here is one of the solutions, open file jquery.mobile.vmouse.js and comment out line

$( this ).bind( realType, dummyMouseHandler );

I've tested it on an iPad and copy functionality is available after that tiny patch.

@jblas jblas was assigned Jun 8, 2012
@toddparker
Contributor

@jblas - Can you comment on the impact of this change on vmouse?

@jblas
Contributor
jblas commented Jun 8, 2012

As @alexboots Mentioned above, I added it to get opera mini to work. Opera mini, as well as some other browsers, won't dispatch a mouse event for a given element unless it actually has an event listener for that event on it. Without that dummy listener mouse events weren't happening at all.

I'm not sure why it breaks iOS ... I guess the question is if you click and hold on an event with legitimate handler on it, does it behave the same? Note that we are only installing handlers on elements that we were explicitly asked to install the v-event on. In other words if you switched the event you are binding to from vmousedown to say mousedown, does the problem still happen?

@ldeluca
Contributor
ldeluca commented Oct 23, 2014

Hey @toddparker and @jblas It's been a couple years since anyone has commented on this issue. Can you guys confirm whether or not this is still an issue with the latest JQM?

@arschmitz
Member

Closing as wont fix dialogs are deprecated in 1.4 and we wont be fixing any thing with vmouse as we are replacing with a pointer event polyfill.

@arschmitz arschmitz closed this Oct 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment