Skip to content

Fix touch gesture conflicts in WebGL example apps on mobile#554

Open
mel-anthropic wants to merge 2 commits intomodelcontextprotocol:mainfrom
mel-anthropic:mel/fix-touch-action-webgl
Open

Fix touch gesture conflicts in WebGL example apps on mobile#554
mel-anthropic wants to merge 2 commits intomodelcontextprotocol:mainfrom
mel-anthropic:mel/fix-touch-action-webgl

Conversation

@mel-anthropic
Copy link
Contributor

On touch devices, drag/pan gestures inside the WebGL-based example apps (Maps, ThreeJS, Wiki Explorer) were propagating to the parent scroll view, causing the page to scroll while trying to interact with the 3D content.

Root cause: The rendering libraries these apps use (CesiumJS, Three.js OrbitControls, force-graph) handle drag interaction via pointer events. On touch devices, the browser doesn't know that these pointer event handlers are "consuming" the touch — it still interprets the gesture as a scroll and forwards it to the parent scroll view. The browser only backs off when it sees explicit touch event handlers that signal "I'm handling this touch, don't scroll."

Fix: Add touchstart/touchmove event handlers on the interactive canvas elements that call preventDefault() to signal to the browser that the touch is being handled by the app. Shadertoy already had correct touch handlers, so only a CSS hint was added there.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 17, 2026

Open in StackBlitz

@modelcontextprotocol/ext-apps

npm i https://pkg.pr.new/@modelcontextprotocol/ext-apps@554

@modelcontextprotocol/server-basic-preact

npm i https://pkg.pr.new/@modelcontextprotocol/server-basic-preact@554

@modelcontextprotocol/server-basic-react

npm i https://pkg.pr.new/@modelcontextprotocol/server-basic-react@554

@modelcontextprotocol/server-basic-solid

npm i https://pkg.pr.new/@modelcontextprotocol/server-basic-solid@554

@modelcontextprotocol/server-basic-svelte

npm i https://pkg.pr.new/@modelcontextprotocol/server-basic-svelte@554

@modelcontextprotocol/server-basic-vanillajs

npm i https://pkg.pr.new/@modelcontextprotocol/server-basic-vanillajs@554

@modelcontextprotocol/server-basic-vue

npm i https://pkg.pr.new/@modelcontextprotocol/server-basic-vue@554

@modelcontextprotocol/server-budget-allocator

npm i https://pkg.pr.new/@modelcontextprotocol/server-budget-allocator@554

@modelcontextprotocol/server-cohort-heatmap

npm i https://pkg.pr.new/@modelcontextprotocol/server-cohort-heatmap@554

@modelcontextprotocol/server-customer-segmentation

npm i https://pkg.pr.new/@modelcontextprotocol/server-customer-segmentation@554

@modelcontextprotocol/server-debug

npm i https://pkg.pr.new/@modelcontextprotocol/server-debug@554

@modelcontextprotocol/server-map

npm i https://pkg.pr.new/@modelcontextprotocol/server-map@554

@modelcontextprotocol/server-pdf

npm i https://pkg.pr.new/@modelcontextprotocol/server-pdf@554

@modelcontextprotocol/server-scenario-modeler

npm i https://pkg.pr.new/@modelcontextprotocol/server-scenario-modeler@554

@modelcontextprotocol/server-shadertoy

npm i https://pkg.pr.new/@modelcontextprotocol/server-shadertoy@554

@modelcontextprotocol/server-sheet-music

npm i https://pkg.pr.new/@modelcontextprotocol/server-sheet-music@554

@modelcontextprotocol/server-system-monitor

npm i https://pkg.pr.new/@modelcontextprotocol/server-system-monitor@554

@modelcontextprotocol/server-threejs

npm i https://pkg.pr.new/@modelcontextprotocol/server-threejs@554

@modelcontextprotocol/server-transcript

npm i https://pkg.pr.new/@modelcontextprotocol/server-transcript@554

@modelcontextprotocol/server-video-resource

npm i https://pkg.pr.new/@modelcontextprotocol/server-video-resource@554

@modelcontextprotocol/server-wiki-explorer

npm i https://pkg.pr.new/@modelcontextprotocol/server-wiki-explorer@554

commit: 37a1c3e

@mel-anthropic mel-anthropic marked this pull request as ready for review March 17, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant