I hope someone has some useful insights for me on this issue:
We are developing a hybrid application for mobile platforms (currently android using cordova). The application is fullscreen (MATCH_PARENT) and all the movement should be handled in the web code. This works fine by using preventDefault() on touch events for the most part. For the last few days however we've been troubleshooting a bug where the webview scrolls instead of it's contents (default touch behaviour, the app scrolls instead of the web code).
We went through a lot of stack overflow solutions to no avail: document.addEventListener("touchmove", preventBehavior, false); - prevents me using from using overflow: scroll; - work around?, Android - undesired WebView movement on drag gesture, Disable scrolling in webview?, How to fix"Miss a drag as we are waiting for WebCore's response for touch down" & How to disable horizontal scrolling in Android webview to name a few.
Finally we found this: https://code.google.com/p/chromium/issues/detail?id=260732 which explains that touch events handled in the web code that take longer than 200ms to execute will be canceled and sent to UIThread for handling.
This is of course intended behaviour and is currently worked on. As mentioned in the thread chromium 35 will have support for the touch-action:none css property (http://www.w3.org/TR/pointerevents/#the-touch-action-css-property).
Finally for the problem and the actual question:
We want to handle all touch events in web code (JavaScript) and the application is designed for it. Is there a way to prevent android and cordova from canceling the webkit/chromium event handling and calling default behaviour. Plus points for a general solution since we want to support Android >4.0 (both webkit and chromium).
For KitKat (chromium 30) we managed to get rid of the problem simply by making touch event handlers call the functionality in timeouts. This however won't work for older and especially slower devices (tested on Galaxy tab 2 and Galaxy S2).
I'll be very thankful for any answers on the subject.
EDIT
I should also note that I read through the WebViewInputDispatcher (android.webkit.webviewinputdispatcher.java, android 4.1.1) and it describes the behaviour = queueing the touch event to the web handlers > starting timer > timer exceeds 200ms & web event not consumed by web code > cancel web event and call ui touch event instead.