touch-action
The CSS property that tells the browser in advance which touch gestures it should handle itself, such as vertical panning, and which to leave to your code.
In more detail
touch-action: pan-y keeps native vertical scrolling while giving horizontal swipes to a carousel, and none gives every gesture to a drawing canvas. Because it is declared in CSS, the browser knows before any JavaScript runs and adds no delay.
Related terms
- touch events — Events such as touchstart and touchmove fired when fingers touch and move on a touchscreen.
- Pointer Events — A single set of events, such as pointerdown and pointermove, that covers mouse, pen and touch input with one code path.
- gesture — A touch movement with a meaning, such as a swipe, a pinch to zoom or a pan to scroll.
- passive event listener — An event listener registered with { passive: true }, which promises never to call preventDefault, so the browser can scroll immediately without waiting for it.
Taught in
- Passive Listeners, Scroll Performance And Touch Interactions — Frontend Architecture & Web Platform