Outdated touch operations in mobile applications

In previous mobile applications that I developed, I found that the click event does not work properly in all devices (for example, in games in which the user had to quickly click on the screen, instead of triggering the click event, a double click was activated), and using touchstart gave the best results for what I wanted.

Since then, I started listening to the touchstart event instead of click ; but testing in Chrome, I received the following warning in the JS console:

Operations requiring explicit user interaction in touchstart events are deprecated and will be deleted in M54 around October 2016. See https://www.chromestatus.com/features/5649871251963904 for more details.

I visited the linked page (and the links inside it), and it seems that this new behavior is to avoid certain unwanted actions and, in particular, to avoid third-party iframes or ads (my application does not have) from opening pop-ups. I tried to change the event to touchend (as indicated in one of the links "The touchhend event will continue to behave as before"), but received a similar warning message.

And my questions are:

  • Is it something that only affects Chrome, or will it affect my web applications (using Cordova / Phonegap) for Android and iOS?
  • What event should be used to replace touchstart and avoid problems that I encountered in the past? I could go back to click , but a quick click / click would still be a problem.
+6
source share
1 answer

When you create a Cordova application, you target different versions of the OS, Android 5 and higher have an automatic webview update based on Chromium, so the problem will probably affect your applications.

But since Chrome 32, when using this viewport <meta name="viewport" content="width=device-width"> delay should disappear (see this article ) so that you can safely use the click event. Recent web reviews on Android 5 and 6 are based on the Chromium 52.

You can also use the fastclick library, which will “fix” the click delay only where necessary

+4
source

All Articles