fix: enable vertical touch scrolling in mobile diff view#694
Conversation
setPointerCapture was called immediately on pointer down, which stole all touch events from the browser before the gesture direction was known. Combined with overflow:hidden on all diff containers, this completely blocked vertical scrolling on mobile. Now the gesture direction is detected first (8px dead zone), and setPointerCapture is only called when horizontal drag intent is confirmed. For vertical intent, touch deltas are translated into scrollController.scrollBy calls via a new bindable scrollApi prop exposed by DiffViewer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 025af1eee0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| event.preventDefault(); | ||
| diffViewerScrollApi?.scrollBy('after', -deltaY); |
There was a problem hiding this comment.
Preserve mobile scrolling for markdown preview
When a Markdown diff is toggled to preview mode on a small viewport, the preview panes scroll via native overflow-y: auto on .code-area.markdown-mode, not via scrollController. This vertical branch now calls preventDefault() and only updates diffViewerScrollApi.scrollBy('after', ...), so a touch swipe that enters this mode can suppress the native preview scroll while changing an off-screen code-mode scroll position instead. Gate this path out for markdown preview or expose an API that scrolls the active markdown container.
Useful? React with 👍 / 👎.
Signed-off-by: Matt Toohey <contact@matttoohey.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
scrollApifromDiffViewersoDiffModalcan programmatically scroll the diff panels during touch gesturesTest plan
🤖 Generated with Claude Code