Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

On browsers that support touch-action, rely on it to disable the tap delay #498

Open
RByers opened this issue Sep 1, 2016 · 1 comment

Comments

@RByers
Copy link

RByers commented Sep 1, 2016

Chrome, Safari, Edge and (soon) FireFox all support) using touch-action: manipulation to disable the click delay without the side effects of FastClick.js (eg. without disabling features like touch adjustment, tap suppression during flings, interfering with forms, etc.). Rather than look to see if the layer is using a touch-action style, why not set that style explicitly on the layer for browsers that support it (if touch-action isn't already specified) and then do nothing else? That would be less brittle (and so avoid issues like #497).

@RByers
Copy link
Author

RByers commented Sep 1, 2016

Note that if you really wanted to rely on the page author setting the touch-action style rather than have FastClick set style itself, then I think you'd want to be a little more thorough in looking for it. For now it'll only trigger in cases like <body style="touch-action: manipulation">.

To be complete you'd need to:

  1. Consult getComputedStyle instead of just layer.style
  2. Walk the DOM from layer up to the documentElement (a little tricky if you want to ShadowDOM for handle web components properly). If ANY of them have touch-action set, that'll disable the tap-delay.
  3. Also handle any value other than auto (or strings that include the Microsoft-propritary double-tap-zoom token)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant