touch-action
Example
body {
touch-action: none;
}.signature-pad {
touch-action: none;
}
.carousel {
touch-action: pan-y;
}Only the drawing area blocks browser gestures, and the carousel still lets the page scroll vertically.
Common mistakes
- Pointer events get cancelled mid-drag because the browser starts scrolling.
- Setting
touch-action: noneon thebodyand breaking scroll and zoom.
Key points
- Elements with custom pointer drag or drawing set
touch-action: noneonly on that element. - Horizontal sliders use
touch-action: pan-yso vertical page scrolling still works. - Pinch zoom is not disabled for the whole page.
Interview questions
What does touch-action: manipulation do?
It allows panning and pinch zoom but disables double-tap zoom, so taps respond without waiting for a second tap.
Why do my pointermove events stop on mobile?
The browser takes over the gesture to scroll and fires pointercancel; set a touch-action that blocks that gesture.