Skip to content

fix(scroll): axis-intent wheel detection for Windows diagonal scroll#28

Merged
shiqkuangsan merged 1 commit intomainfrom
fix/windows-diagonal-scroll
Mar 24, 2026
Merged

fix(scroll): axis-intent wheel detection for Windows diagonal scroll#28
shiqkuangsan merged 1 commit intomainfrom
fix/windows-diagonal-scroll

Conversation

@shiqkuangsan
Copy link
Copy Markdown
Owner

@shiqkuangsan shiqkuangsan commented Mar 24, 2026

🤔 This is a ...

  • 🐞 Bug fix

🔗 Related Issues

User feedback: Windows 11 mouse wheel scrolling in grouped mode feels "diagonal" — items scroll at an angle instead of purely horizontal.

💡 Background and Solution

Root cause: The onRowWheel handler used deltaX !== 0 as an early return to let native handle trackpad input. However, Windows Precision Touchpads and high-resolution mice produce wheel events with both deltaX and deltaY non-zero simultaneously (per W3C spec). Combined with nested scroll containers (inner horizontal GroupRow + outer vertical group list), the browser splits the mixed-axis event across both layers → diagonal scrolling.

Fix:

  • Replace deltaX !== 0 early return with axis-intent detection: |deltaX| > |deltaY| → native (trackpad horizontal swipe), otherwise intercept and convert to horizontal scroll
  • Add deltaMode normalization to pixels (line=40px, page=800px) for consistent scroll speed across platforms
  • Add ctrlKey passthrough to avoid interfering with zoom
  • Preserve existing boundary handoff (at scroll edges, bubble to outer vertical container)

🧪 Test Plan

  • Existing tests pass (pnpm test) — 270 passed
  • Type check passes (npx tsc --noEmit)
  • Manual testing on Windows 11 (needs user verification)
  • Manual testing on macOS: trackpad horizontal/vertical, boundary handoff

📝 Changelog

Language Changelog
🇺🇸 English Fix diagonal scrolling on Windows when using mouse wheel in grouped mode
🇨🇳 中文 修复 Windows 分组模式下鼠标滚轮斜向滚动的问题

Summary by CodeRabbit

  • Bug Fixes
    • Improved scrolling behavior for trackpad and mouse wheel input with better handling of modifier keys and mixed-axis scrolling gestures.

Replace the naive `deltaX !== 0` early return with axis-intent
classification that tolerates mixed-axis input from Windows Precision
Touchpads and high-resolution mice. Also normalize deltaMode to pixels
for consistent scroll speed across platforms.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recopy Ready Ready Preview, Comment Mar 24, 2026 2:26pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0ee235e4-815b-46f1-aa89-d9221a12927f

📥 Commits

Reviewing files that changed from the base of the PR and between 9c18faa and 93a8369.

📒 Files selected for processing (1)
  • src/components/ClipboardList.tsx

📝 Walkthrough

Walkthrough

The wheel-to-horizontal scrolling handler now supports both mouse wheel and trackpad gestures. It normalizes deltaX and deltaY values using deltaMode, detects axis intent, bypasses native handling for keyboard modifiers, and updates boundary logic and scroll calculations to use normalized values instead of raw inputs.

Changes

Cohort / File(s) Summary
Wheel scroll handler enhancement
src/components/ClipboardList.tsx
Enhanced wheel event handler with deltaMode-based normalization (LINE_HEIGHT and PAGE_HEIGHT multipliers), axis-intent detection to allow native behavior for dominant horizontal input, keyboard modifier handling (ctrlKey/shiftKey bypass), and updated boundary-bubbling and scroll increment logic to use normalized dy instead of raw deltaY.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A wheel turns smooth, no more jitter here,
Trackpad and mouse now blend with cheer,
Normalized deltas dance with intent,
Scrolling refined—the coder's ascent! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(scroll): axis-intent wheel detection for Windows diagonal scroll' directly and clearly summarizes the main change—implementing axis-intent detection to fix diagonal scroll behavior on Windows, which is the primary objective of this pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-diagonal-scroll

Comment @coderabbitai help to get the list of available commands and usage tips.

@shiqkuangsan shiqkuangsan merged commit ba0ea34 into main Mar 24, 2026
9 checks passed
@shiqkuangsan shiqkuangsan deleted the fix/windows-diagonal-scroll branch March 24, 2026 14:32
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