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
).
Are the following actions prevented if you prevent the default ontouchstart?
iOS | Android | Chrome | Opera | Black |
Nokia | UC | Puffin | Nin |
Dol |
Tizen | One | IE 10 | Firefox | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | 7 | 2 | 4 | 28 | 31 | Mini | Mob 12 | Mob 18 | 6 | 7 | 10 | Xpr |
Mee |
An |
Bel |
Mini | 8 | 9 | OS | And | |||||||||
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 | - | Al |
No | - | Yes | No | Yes | No | Yes | |||||||||
|
|||||||||||||||||||||||||||||
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 | Unre |
|||||||||||
|
|||||||||||||||||||||||||||||
Pinch-zoom
|
Yes | No | Yes | Yes | - | Yes | No | Yes | - | No | - | No | - | No | Yes | - | Yes | No | Yes | Unre |
|||||||||
|
|||||||||||||||||||||||||||||
Touchhold
|
Yes | Yes | See below | Yes | - | Yes | No | Yes | - | Yes | - | No | - | Yes | - | Yes | No | Yes | No | Yes | |||||||||
Are the following actions prevented if you prevent the default ontouchmove?
iOS | Android | Chrome | Opera | Black |
Nokia | UC | Puffin | Nin |
Dol |
Tizen | One | IE 10 | Firefox | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | 7 | 2 | 4 | 28 | 31 | Mini | Mob 12 | Mob 18 | 6 | 7 | 10 | Xpr |
Mee |
An |
Bel |
Mini | 8 | 9 | OS | And | |||||||||
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 | |||||||||||||
|
|||||||||||||||||||||||||||||
Double tap
|
No | No | No | - | No | Yes | No | - | No | - | No | - | No | No | No | ||||||||||||||
Scroll
|
Yes | Yes | Yes | - | Yes | Yes | No | Yes | - | Yes | - | No | - | Yes | - | Incom |
Yes | No | No | Unre |
|||||||||
|
|||||||||||||||||||||||||||||
Pinch-zoom
|
Yes | No | Yes | Yes | - | Incom |
Yes | No | Yes | - | Yes | - | No | - | Yes | - | Yes | No | No | Unre |
|||||||||
|
|||||||||||||||||||||||||||||
Touchhold
|
No | No | No | - | No | No | Yes | - | No | - | No | - | No | - | No | No | No | ||||||||||||
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.
Xiaomi | Huawei | Note I | Sony | LG | S3 | HTC | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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
|
Al |
Yes | Yes | Yes | Yes | Yes | Incom |
||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
Pinch-zoom
touchstart and touchmove
|
Yes | Yes | Yes | Yes | Yes | Yes | Incom |
||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
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. |
Mobile browser test array 1.2.5; January 2014