Hacker News new | ask | show | jobs
by nevir 3907 days ago
If you're building your website to behave well on mobile devices, you're likely implementing your own touch handlers and are not using click events to begin with.
2 comments

This is actually very hard to implement.

The underlying issues are that

(a) it is hard to make touchstart/touchend act the same as a native click event (touch-scroll interactions, different fat finger slippage, text selection, press duration, etc).

(b) you only want to do this for iOS and not any other browser (different browsers and OSes and pointing devices introduce a huge number of other issues: cant prevent the click on the touchend, mouse or pen support is difficult, avoiding ghost taps https://www.google.com/#q=ghost+click+tap ).

(c) you run into future compatibility problems (pen, force-clicks, other HIDs).

True. But that's where http://www.w3.org/TR/pointerevents/ comes in
Even if you use nothing but touch events on IOS, the 350ms delayed click can still cause problems. For example, suppose you want a button to pop open a small form over the top of the page and automatically focus the first input in the form. You can wire up a touch event so you don't have a delay, but then the input gets focused and then un-focused 350ms later, because a delayed click happened somewhere else on the page. Or maybe a different field gets focused because it's now directly above where that button used to be.