ftlabs / fastclick

Polyfill to remove click delays on browsers with touch UIs
MIT License
18.66k stars 3.22k forks source link

Interaction with Chromium's removall of tap delay #138

Open paulirish opened 11 years ago

paulirish commented 11 years ago

I'm sure y'all have seen the discussion here: https://code.google.com/p/chromium/issues/detail?id=169642

A patch is currently in review: https://codereview.chromium.org/18850005/

This patch disables double tap zoom on pages that have a width=device-width or narrower viewport (indicating that this is a mobile-optimized or responsive website), unless the user has pinch-zoomed in by more than 10% (in which case they might reasonably expect to be able to zoom back out using double-tap zoom).

Double tap zoom continues to be disabled for pages that disallow the user from zooming (even if they don't have a device-width or narrower viewport).

This causes very noticeable performance benefits (links, buttons, checkboxes, etc) respond within around 10ms instead of 300ms.

I was wondering if @mattcg has any feedback on the patch. Also curious if this new behavior will introduce any problems to developers using fastclick.

Perhaps in the future, we could identify a UserAgent blacklist that doesn't need to be served fastclick any longer.

cc @jakearchibald

mattcg commented 11 years ago

Thanks for this @paulirish. I was under the impression that Chrome was going with user-scalable=no as a flag for disabling double-tap to zoom. Is the idea to abandon this in favor of width=device-width?

Not a problem if so, I'll just modify the existing code in FastClick.notNeeded.

paulirish commented 11 years ago

AFAIUI, user-scalable=no will get no more delay. I believe that already landed. This is now a newer patch.

On Thu, Jul 18, 2013 at 5:28 PM, Matthew Caruana Galizia < notifications@github.com> wrote:

Thanks for this @paulirish https://github.com/paulirish. I was under the impression that Chrome was going with user-scalable=nohttps://code.google.com/p/chromium/issues/detail?id=169642#c8as a flag for disabling double-tap to zoom. Is the idea to abandon this in favor of width=device-width?

Not a problem if so, I'll just modify the existing code in FastClick.notNeeded.

— Reply to this email directly or view it on GitHubhttps://github.com/ftlabs/fastclick/issues/138#issuecomment-21195939 .

jakearchibald commented 11 years ago

This new patch eliminates the need for fastclick if width=device-width, but the 300ms delay returns if the user pinch-zooms the page, because double-tap is the gesture to zoom back out.

Although pinch-zooming brings the delay back, width=device-width + Chrome version feels like the best "detect".

As @paulirish says, pages that prevent zooming already avoid the 300ms delay, that will continue to be the case.

mattcg commented 11 years ago

Sounds reasonable to me! Another step closer to being able to ditch FastClick altogether....

I'll implement a check for width=device-width + Chrome version in a feature branch, ready to merge in when the change lands.

patrickhlauke commented 11 years ago

A late and tangential comment, but just wanted to mention that Firefox/Android also now removes the delay when user-scalable=no and min/max scale are both equal, same as Chrome in those cases. Also seeing if there's any chance to drum up some Webkit love for this optimization https://bugs.webkit.org/show_bug.cgi?id=122212