drop icon indicating copy to clipboard operation
drop copied to clipboard

Drop opens/closes right away on touch screen

Open brendancf opened this issue 9 years ago • 10 comments

I am using drop to open a menu. On my iPhone, the menu opens and closes right away rather than having the menu stay open until touching outside the menu. This isn't the behavior I see on my desktop. Anyone else have a similar issue on touch?

brendancf avatar Oct 08 '15 18:10 brendancf

It appears a 'click' and 'touchstart' event is coming in. the first 'click' opens the menu, and the 'touchstart' closes it because it just toggles the open state. I see this behavior on both Safari and Chrome on iOS 9

brendancf avatar Oct 08 '15 18:10 brendancf

Interesting. @geekjuice I agree, it seems this is probably the same as my issue.

sjelfull avatar Oct 13 '15 08:10 sjelfull

+1 I have the same issue here. Is there any idea in solving this? I have not yet checked the code to evaluate a solution.

rhoffmann avatar Dec 14 '15 14:12 rhoffmann

+1 Same problem here

maelfrize avatar Dec 15 '15 17:12 maelfrize

I believe this should be fixed by: https://github.com/HubSpot/drop/pull/131

zackbloom avatar Dec 15 '15 17:12 zackbloom

+1 Same problem here

eemreavci avatar Feb 08 '16 15:02 eemreavci

+1 I have the same issue here

simonkontschak avatar Feb 12 '16 10:02 simonkontschak

+1 same issue here. Any solution ?

remiroyc avatar Mar 23 '16 17:03 remiroyc

Welcome to the wonderful world of touch/click :). There's inconsistencies between browser engines, which is why libraries like Hammerjs exist.

Here's my fix. Checks if Hammer exists, and uses its "tap" method. Works on iOS and everywhere else. Leave the touch/click handling to libraries designed to do so.

btw, @zackbloom your fix didn't work for me on iPad version 9.3.1. Note: this works with Fasttouch too!

https://github.com/HubSpot/drop/compare/master...anzorb:master#diff-8b7a21ae42b059f2d76c6268488bf1d8R303

anzorb avatar Apr 08 '16 16:04 anzorb

I'm using Fastclick and this bug is still present, sad that after 1 year it's still not fixed. A simple way to fix this would be to detect the presence of Fastclick via window.FastClick and plugins alike and do not add touchstart events in this case (https://github.com/HubSpot/drop/blob/master/src/js/drop.js#L30)

Edit: My bad. Fastclick have .needsclick feature that resolve this issue.

ghost avatar Nov 07 '16 15:11 ghost