Skip to content

Instantly share code, notes, and snippets.

Last active May 14, 2024 19:05
Show Gist options
  • Save gajus/bbf06ea2e37047b01e70 to your computer and use it in GitHub Desktop.
Save gajus/bbf06ea2e37047b01e70 to your computer and use it in GitHub Desktop.

The issue: browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

touch-action is now supported by all major mobile browsers.

Note that iOS 9.3 has not been released yet. (2016 02 13)

In ./webpack.js I am first detecting if the touch-action property is supported. If it is, I am using it to set the style of document.body. If it is not, then I am using webpack require.ensure to download FastClick polyfill to fix the issue.

if ('touchAction' in { = 'manipulation';
} else {
require.ensure(['fastclick'], (require) => {
const FastClick = require('fastclick');
window.addEventListener('load', () => {
}, 'fastclick');
Copy link

I know this is old, but as I came across this page looking for advice I thought I would update.

touch-action: manipulation is still necessary to remove the tap delay in Chrome (and presumably others) on touch screens on Windows 10 laptops such as the Dell XPS 13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment