The touch-action
CSS property sets how an element's region can be manipulated by a touchscreen user (for example, by zooming features built into the browser).
By default, panning (scrolling) and pinching gestures are handled exclusively by the browser. An application using pointerup
listeners for the remaining gestures. Applications using preventDefault()
, but should also use touch-action
to ensure the browser knows the intent of the application before any event listeners have been invoked.
When a gesture is started, the browser intersects the touch-action
values of the touched element and its ancestors, up to the one that implements the gesture (in other words, the first containing scrolling element). This means that in practice, touch-action
is typically applied only to top-level elements which have some custom behavior, without needing to specify touch-action
explicitly on any of that element's descendants.
Note:
After a gesture starts, changes to touch-action
will not have any impact on the behavior of the current gesture.