touch-action is the CSS property that declares which touch gestures the browser may handle natively on an element, such as panning, scrolling and pinch zooming, and which gestures it must leave to page scripts. On the mobile web it is the standard way to stop the browser from scrolling or zooming while a custom widget, such as a map, a drawing canvas or a carousel, processes the same finger movement itself.
The property is defined in the W3C Pointer Events specification and is supported by all current mobile browsers. Because it is declarative, the browser knows the allowed gestures before the first touchmove event fires, which lets it keep scrolling on the fast compositor thread instead of waiting for JavaScript.
How touch-action decides gesture ownership
When a finger touches the screen, the browser performs a hit test and then computes the effective touch-action for that contact point. It does this by intersecting the touch-action values of the touched element and every ancestor up to the nearest scroll container, so a restriction set on a parent cannot be loosened by a child.
The result is fixed at the start of the gesture. Changing the property in a script halfway through a swipe has no effect on that swipe; it applies only to the next touch. Anything the browser is not allowed to handle becomes a regular stream of pointer events or touch events for page code, and the browser sends a pointercancel event when it takes over a gesture it is permitted to handle.
This model explains why touch-action matters for performance. Without it, a page that wants to block scrolling must call preventDefault() inside a touchmove listener, which forces the browser to wait for the main thread before every scroll frame. With touch-action, the decision is available up front, and scroll listeners can be registered as passive listeners without losing control over the gesture.
Values of the touch-action property
The property accepts keyword values that either name a single behavior or combine pan directions with zoom. The following table lists the values defined in the specification and what each permits.
| Value | Browser may handle | Typical use |
|---|---|---|
| auto | All panning and zooming | Default for ordinary content |
| none | No panning or zooming | Canvas, maps, games |
| pan-x | Horizontal panning only | Vertical custom sliders |
| pan-y | Vertical panning only | Horizontal carousels |
| pan-left, pan-right, pan-up, pan-down | Panning that starts in one direction | Pull-to-refresh, edge swipes |
| pinch-zoom | Multi-finger zoom and its panning | Combined with pan values |
| manipulation | Panning and pinch zoom, no double-tap zoom | Buttons and tap targets |
Values can be combined, for example pan-x pinch-zoom or pan-y pinch-zoom, but auto, none and manipulation must stand alone. The value manipulation became popular because removing double-tap zoom also removes the old 300-millisecond tap delay that browsers once added while waiting for a possible second tap. Modern browsers already skip that delay when the viewport meta tag sets width=device-width, so manipulation is now mainly a safeguard.
The single-direction values such as pan-down are less widely supported than the axis values. Teams that rely on them should test on real devices and design a fallback that still works when only pan-x and pan-y are honored.
How touch-action compares with related techniques
Several mechanisms influence what happens when a user drags a finger across a page. They overlap in purpose but work at different layers of the browser, as the next table shows.
| Technique | Layer | What it controls | Main drawback |
|---|---|---|---|
| touch-action | CSS, declarative | Native pan and zoom per element | Fixed at gesture start |
| preventDefault() in touchmove | JavaScript | Cancels default per event | Blocks fast scrolling |
| overscroll-behavior | CSS, declarative | Scroll chaining and bounce | Does not stop panning |
| user-scalable=no in viewport | HTML meta tag | Page-wide zoom | Harms accessibility |
| Pointer capture | JavaScript API | Which element receives events | Does not stop native gestures |
The key distinction is that touch-action decides ownership of the gesture, while overscroll-behavior only decides what happens when a scroll container reaches its edge. Pinch to zoom, touch events and the viewport meta tag are neighboring concepts in the mobile web: touch-action is the element-level control that coordinates all of them.
Applying touch-action in real interfaces
The safest approach is to restrict only the gesture a widget actually needs and leave everything else to the browser. A horizontal carousel needs the horizontal axis, so declaring pan-y keeps vertical page scrolling native while the script handles sideways swipes.
| Component | Recommended value | Reason |
|---|---|---|
| Image carousel | pan-y | Page still scrolls vertically |
| Interactive map | none | Script owns pan and zoom |
| Signature or drawing pad | none | Strokes must not scroll the page |
| Range slider | pan-y or pan-x | Free the axis the thumb does not use |
| Zoomable photo viewer | pan-x pan-y | Native panning, custom zoom |
| Tap-heavy buttons | manipulation | No accidental double-tap zoom |
Apply the value to the interactive element itself, not to body or html. A page-wide touch-action: none disables scrolling and zooming for the entire document, which is one of the most serious accessibility failures a mobile site can introduce.
- Pair touch-action with pointer events so mouse, pen and touch share one code path.
- Register scroll and touch listeners as passive when they never cancel the default.
- Keep the restricted area visibly distinct so users know where gestures behave differently.
- Verify behavior in Chrome DevTools device mode and on at least one physical iOS and Android device.
Limitations and common mistakes
Most problems with touch-action come from misunderstanding its inheritance rules or its timing. The property is not inherited in the CSS sense, yet its effect still combines with ancestors through the intersection rule, which surprises many developers.
| Symptom | Cause | Fix |
|---|---|---|
| Page cannot be scrolled | none set on a large container | Limit none to the widget |
| Child value ignored | Ancestor already restricts gestures | Relax the ancestor value |
| Swipe still scrolls | Value changed mid-gesture | Set the value before touch starts |
| Users cannot zoom text | none or pan values without pinch-zoom | Add pinch-zoom where possible |
| Works on desktop only | Tested with a mouse, not touch | Test with real touch input |
touch-action also does not affect mouse wheels or trackpads; it only applies to direct manipulation by touch and, in some browsers, pen input. Developers who need to control wheel scrolling still require overscroll-behavior or event handling, and they should treat touch-action as one part of a gesture strategy, not a complete solution.
Put simply
When you drag a finger on a phone, the browser usually assumes you want to scroll or zoom the page. That is great for reading, but it gets in the way when you are drawing a signature or moving a map.
touch-action is a short instruction a web page gives the browser about one specific area: here, leave this movement to me. It works like a sign on a door saying who is responsible for what. The rest of the page keeps scrolling normally, and only the marked area behaves differently.
In practice
A delivery company builds a mobile web page where couriers collect a customer signature on a canvas about 300 by 150 pixels. In early tests, every downward stroke of the pen scrolled the page, so the signatures came out as broken fragments and couriers had to ask customers to sign again.
The developers add touch-action: none to the canvas only and switch the drawing code from touch events to pointer events. The surrounding form still scrolls normally, and the page keeps pinch zooming for customers who need larger text. After the change, incomplete signatures largely disappear, and the same code also works with a stylus on tablets and a mouse on desktop computers.