Preventing the touch default
On this page I present the results of my research into preventing the default of touch actions.
Theory is clear, and most important browsers follow it. The default of all actions is prevented when you return false (or call preventDefault()
) ontouchstart. The touchmove event is trickier: only scroll and pinch-zoom are prevented when you return false on that event. This makes sense, since these two actions are the only ones that actually require the user’s touch to move.
The proxy browsers, Symbian Anna, and Puffin do not support the touch events and are untestable. IE10 supports the pointer events, but does nothing when you return false (or call preventDefault()
; or set returnValue
). This likely has something to do with the fact that you prevent the defaults in CSS (-ms-touch-action
).
Touchstart prevented
Are the following actions prevented if you prevent the default ontouchstart?
Tap (click)
|
Yes |
Yes |
See below |
Yes |
- |
Yes |
Yes |
- |
Yes |
- |
No |
- |
Yes |
No |
- |
Yes |
No |
Yes |
No |
Yes |
|
Event cascade
|
Yes |
Yes |
See below |
Yes |
- |
Yes |
Yes |
- |
Yes |
- |
No |
- |
Almost |
No |
- |
Yes |
No |
Yes |
No |
Yes |
- Android 4 and One fire mouseover and mousemove. They always come before touchstart, so they aren’t cancelled by the touchstart.
- UC 8 fires the mouseup event, but none of the others.
|
Double tap
|
Yes |
Yes |
See below |
Yes |
- |
Yes |
Yes |
- |
Yes |
- |
No |
- |
Yes |
No |
Yes |
No |
Yes |
|
Scroll
|
Yes |
Yes |
Yes |
- |
Yes |
Yes |
- |
Yes |
- |
No |
- |
No |
Yes |
- |
Yes |
No |
Yes |
Unreliable |
- Firefox 25 sometimes suppresses the scrolling, but not always. Worse on the Pocket than on the HTC. Vertical scrolling more dangerous than horizontal.
|
Pinch-zoom
|
Yes |
No |
Yes |
Yes |
- |
Yes |
No |
Yes |
- |
No |
- |
No |
- |
No |
Yes |
- |
Yes |
No |
Yes |
Unreliable |
- Firefox 25 sometimes suppresses the pinch-zoom, but not always. Worse on the Pocket than on the HTC.
|
Touchhold
|
Yes |
Yes |
See below |
Yes |
- |
Yes |
No |
Yes |
- |
Yes |
- |
No |
- |
Yes |
- |
Yes |
No |
Yes |
No |
Yes |
|
Touchmove prevented
Are the following actions prevented if you prevent the default ontouchmove?
Tap (click)
|
No |
No |
No |
- |
No |
No |
- |
No |
- |
No |
- |
No |
- |
No |
No |
No |
|
Event cascade
|
No |
No |
No |
- |
No |
No |
- |
No |
- |
No |
- |
No |
- |
No |
No |
No |
- Android 4: Xiaomi and Huawei usually fire an extra mouseout and mousemove event before the regular cascade.
|
Double tap
|
No |
No |
No |
- |
No |
Yes |
No |
- |
No |
- |
No |
- |
No |
No |
No |
|
Scroll
|
Yes |
Yes |
Yes |
- |
Yes |
Yes |
No |
Yes |
- |
Yes |
- |
No |
- |
Yes |
- |
Incomplete |
Yes |
No |
No |
Unreliable |
- The HTC Android 4 does not prevent scrolling.
- Nintendo allows one single scroll per action, but not more. So the scrolling is not smooth and ends abruptly. This is likely a bug.
- Firefox 25 sometimes suppresses the scrolling, but not always. Worse on the Pocket than on the HTC. Vertical scrolling more dangerous than horizontal.
|
Pinch-zoom
|
Yes |
No |
Yes |
Yes |
- |
Incomplete |
Yes |
No |
Yes |
- |
Yes |
- |
No |
- |
Yes |
- |
Yes |
No |
No |
Unreliable |
- The HTC Android 4 does not prevent pinch-zooming.
- Opera 12.10 Android prevents pinch-zooming; 12.00 on Symbian doesn’t.
- Firefox 25 sometimes suppresses the pinch-zoom, but not always. Worse on the Pocket than on the HTC.
|
Touchhold
|
No |
No |
No |
- |
No |
No |
Yes |
- |
No |
- |
No |
- |
No |
- |
No |
No |
No |
|
Android 4
This table is specifically for Android 4, and mostly about the touchstart event. In general, Android 4 does not prevent the default ontouchmove. Exceptions: scroll and pinch-zoom.
Tap (click)
touchstart only
|
No |
No |
Yes |
No |
Yes |
Yes |
Yes |
|
Event cascade
touchstart only
|
No |
No |
Yes |
No |
Yes |
Yes |
Yes |
General note: Android 4 always fires mouseover and mousemove, since they occur before touchstart. This is not counted as a bug.
|
Double tap
touchstart only
|
No |
No |
Yes |
No |
No |
Yes |
Yes |
|
Scroll
touchstart and touchmove
|
Almost |
Yes |
Yes |
Yes |
Yes |
Yes |
Incomplete |
- Xiaomi prevents the default, but nonetheless allows the scrolling of the browser interface.
- The HTC does not prevent the default ontouchmove.
|
Pinch-zoom
touchstart and touchmove
|
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Incomplete |
- The HTC does not prevent the default ontouchmove.
|
Touchhold
touchstart only
|
Sort of |
Sort of |
Yes |
Sort of |
Sort of |
Sort of |
Yes |
Normally, the element is selected (colour change), the phone may vibrate, and a word is selected. All devices except for Note I and HTC select the element, but do not vibrate or select a word.
The Note I doesn’t even select the element. The HTC does, but removes the selection quickly.
|
Browsers
- iOS 6
- Default browser on iPhone 4S with iOS 6.1.3
- iOS 7
- Default browser on iPad 2 with iOS 7.0.4
- Android 2
- Default browser on HTC Legend, Android 2.2
- Default browser on Samsung Galaxy Pocket, Android 2.3.6
- Android 4
- Default browser on Xiaomi M2, Android 4.1.1
- Default browser on Huawei C8813, Android 4.1.1
- Default browser on Samsung Galaxy Note I, Android 4.1.2
- Default browser on Sony Xperia S, Android 4.1.2
- Default browser on LG L5, Android 4.1.2
- Default browser on Samsung Galaxy S3, Android 4.1.2
- Default browser on HTC One X, Android 4.2.2
- Chrome 28
- Default browser on Samsung Galaxy S4, Android 4.3
- It will be interesting to see if Samsung’s purported Chrome 18 is really the real Chrome 28.
- Chrome 31
- On HTC One X, Android 4.2.2
- On Nexus 7, Android 4.4
- Opera Mini
- 7.0.5 on iPad 2, iOS 7.0.3
- 7.1 on BlackBerry 9800 (OS6)
- 7.1 on Nokia PureView 808, Symbian Belle
- 7.5 on Samsung Galaxy Note I, Android 4.0.3
- Opera Mobile 12
- 12.00 on Nokia E7, Symbian Anna
- 12.10 on Samsung Galaxy Pocket, Android 2.3.6
- Opera Mobile 18
- On Sony Xperia S, Android 4.1.2
- On Nexus 7, Android 4.3
- BlackBerry 6
- Default browser on BB Torch 9800 (OS6)
- BlackBerry 7
- Default browser on BB Torch 9810 (OS7)
- BlackBerry 10
- Default browser on BlackBerry Z10 (BB OS 10.1)
- This device has 1GB of internal memory instead of the customary 2GB, which may matter in performance tests.
- Xpress
- 3.9 on the Nokia Asha 311, S40.
- This browser used to be called Ovi. Nokia developed it because it saw how succesful Opera was on Nokia’s own devices.
- MeeGo
- Default browser on Nokia N950, MeeGo Harmattan 1.2
- Originally slated as Symbian’s successor, MeeGo was ousted in favour of Windows Phone. Some devices were sold, however, and a Finnish company is trying to re-start MeeGo under the name Sailfish. Also, rumour has it that Nokia is quietly hiring back ex-MeeGo people, so a Nokia-based restart is not entirely impossible.
- Anna
- Default browser (7.3) on Nokia E7, Symbian Anna
- The next-to-last Symbian build. I don’t think it was the prime Symbian build for long; it was replaced by Belle fairly soon. But it’ll be in some people’s pockets.
- Belle
- Default browser (8.3) on Nokia PureView 808, Symbian Belle FP2
- The most recent Symbian build.
- UC Mini
- 8.8 on HTC One X, Android 4.2.2
- UC
- UC 8.5.1 on Xiaomi M2 (Android 4.1.1)
- UC 9.2.3 on Huawei C8813 (Android 4.1.1)
- The largest Chinese browser. This is the full variant, not the proxy. These browsers were pre-installed (next to Android WebKit; don’t ask me why).
- Puffin
- 2.1 Free Edition on Samsung Galaxy Note, Android 4.0.3
- Claims to be Chrome 11
- Nintendo
- Nintendo browser 2.0.0 on Wii U 4.0.0
- Supposed to be based on NetFront.
- Dolphin
- Dolphin 10 with JetPack on Sony Xperia S, Android 4.1.2.
- Independent full browser for Android, as long as you install both Dolphin 10 and the Jetpack extension.
- QQ One
- 4.2.2 on HTC One X, Android 4.2.2
- This is the downloadable, international browser TenCent created.
- Tizen
- Default browser on Ref.Device-PQ by Samsung; Tizen 2.2
- Tizen is an OS jointly being developed by Samsung and Intel. I expect Samsung to start producing devices this year, and it will get a few percent of market share.
- IE10
- Default browser on Nokia Lumia 820, Windows Phone 8.0.
- Firefox OS
- Geekphone/Telefónica (Peak and/or qcom); Boot2Gecko 1.0.1.0-prerelease
- Default browser on ZTE Open, FF OS 1.0.0802
- The ZTE Open will get an upgrade to 1.1 pretty soon.
- Firefox Android
- 25 on Samsung Galaxy Pocket, Android 2.3.6
- 25 on HTC One X, Android 4.2.2