Repository navigation
fix: let the page scroll in the direction touch gestures do not use - #1007
Merged
Merged
Conversation
With pan or pinch enabled the canvas always got `touch-action: none`, so a chart that only pans along x still swallowed vertical swipes. On a phone a chart that fills the screen left no way to scroll the page. The plugin now claims only the directions its touch gestures can act on, taken from `pan.mode` and, when pinch is enabled, `zoom.mode`: `pan-y` when they are limited to x, `pan-x` when limited to y, and `none` as before when both are used. The value follows the mode on every chart update, since the mode can be a function.
A pan that starts over a scale follows `pan.scaleMode` whatever `pan.mode` says, so `mode: 'x'` with `scaleMode: 'y'` pans along y over the y axis. Deriving the touch action from the mode alone handed that swipe to the browser. The scale mode now counts as a used direction. A pinch only zooms along `zoom.mode`, also over a scale, so it needs no such addition. The documentation names the options the value comes from, and says that the browser's pinch zoom stays off over the chart.
kurkle
marked this pull request as ready for review
November 21, 2026 19:11
etimberg
approved these changes
Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With pan or pinch enabled the canvas always got
touch-action: none, so a chart that only pans along x still swallowed vertical swipes, and a chart filling a phone screen left no way to scroll the page.The plugin now claims only the directions its touch gestures can act on:
pan.modeandpan.scaleModewhen panning is enabled, andzoom.modewhen pinch is enabled:touch-actionpan-ypan-xnone(as before)The browser's own pinch zoom stays off in every case, and the value is refreshed on each chart update because the mode can be a function. The default mode is
xy, so charts that do not set a mode behave as before.Verification
Besides the specs for the style value, I drove real touch input through the DevTools protocol in Chromium (mobile emulation, built UMD bundle, a page taller than the viewport):
Not verified on Safari or on physical devices.
Of the two things #791 reports, this fixes the vertical drag being ignored. A pinch over the chart still zooms the chart and not the page when pinch zooming is enabled; that is what the option asks for, and the page can now be scrolled away from the chart.
Fixes #336
Fixes #791