jquery-ui-touch-punch icon indicating copy to clipboard operation
jquery-ui-touch-punch copied to clipboard

Android and Chrome Mobile: jQuery .click() method will not work on elements with the .draggable() method

Open macmadill opened this issue 10 years ago • 11 comments
trafficstars

Tested on a Nexus 9 running Android 5.0.1 & Samsung SM-T520 running 4.4.2.

The jQuery .click() method will no longer work on elements that have the .draggable() method attached to them as well. All elements nested inside the draggable element will also not trigger the .click() method.

This issue only occurred on Chrome Mobile. Firefox and the native Android "Internet" browser did not have this issue on the devices I tested. Chrome versions were 38 & 40.

I have created a codepen here to reproduce the issue: http://codepen.io/macmadill/full/gbXmZG

macmadill avatar Feb 06 '15 14:02 macmadill

Chrome appears to be more sensitive than the other browsers to the 'touchmove' event and is causing touch-punch's simulated click event to be canceled.

macmadill avatar Feb 06 '15 17:02 macmadill

Similar to the pull request for issue #41 : https://github.com/furf/jquery-ui-touch-punch/pull/204/files Instead of having 'touchmove' cancel the click event we could compare the start X & Y positions with the end X & Y positions.

macmadill avatar Feb 09 '15 13:02 macmadill

Any progress on a fix for this?

davideanderson avatar Aug 13 '15 22:08 davideanderson

@davideanderson take a look what mchat did, it's a basic solution but does not work in all cases; I adopted her solution in the way that start and end position don't have to be the exact same (+/-2px); https://github.com/fr33kvanderwand/jquery-ui-touch-punch

fr33kvanderwand avatar Aug 17 '15 13:08 fr33kvanderwand

Will this be Merged anytime soon ? i am noticing the same issue on android chrome and instead of using a forked repo to have a working solution i would rather use the default release

KennethVerbeure avatar Nov 06 '15 15:11 KennethVerbeure

I would love to get this fix for Chrome on Android! Is there an ETA on when this will be merged?

JakedUp avatar May 20 '16 16:05 JakedUp

Same issues for me. Please let me know when fixed.

andreikainer avatar Oct 04 '16 23:10 andreikainer

I've got the same issue. HTC 10 running 6.0.1, jQuery UI 1.12.1, Touch Punch 0.2.3. I am using these libraries within a WebView component of a native Android application.

I have not tried the forked version above yet, but something I just discovered that does fire reliably with the standard library in use is touchend (.on("touchend", function() { ...). Obviously it doesn't fire until the finger is lifted, but for my purposes I think it'll be an acceptable solution.

TrevorPage avatar Oct 27 '16 09:10 TrevorPage

Same issues for me. Please let me know when it's fixed.

dhhung89 avatar Nov 24 '16 09:11 dhhung89

Had the same issue on Android Mobile Chrome Browser but not on Android Mobile Firefox Browser. Also had this issue on my Android Cordova App, because i think it uses the Chrome Browser as WebView.

You don't need to compare pixels, you can use a better solution like:

var touchmoved = false;
$(".selectPatient").on('touchmove', function(e){
	touchmoved = true;

	// do moving stuff
}).on('touchstart', function(e){
	touchmoved = false;
				
}).on('click touchend', function (e) { 
	e.stopPropagation();
	e.preventDefault();
	e.stopImmediatePropagation();
				
	if(touchmoved != true)
	{
					
		// do clicking stuff
	}
				
});

hope this helps

JavanXD avatar Dec 01 '16 12:12 JavanXD

Using jquery mobiles vclick in place of click seemed to work for me.

arattray28 avatar May 21 '17 13:05 arattray28