drop
drop copied to clipboard
Drop opens/closes right away on touch screen
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?
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
Interesting. @geekjuice I agree, it seems this is probably the same as my issue.
+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.
+1 Same problem here
I believe this should be fixed by: https://github.com/HubSpot/drop/pull/131
+1 Same problem here
+1 I have the same issue here
+1 same issue here. Any solution ?
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
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.