Uh oh!
There was an error while loading. Please reload this page.
fix(files): let a mouse wheel scroll CSV and XLSX previews horizontally - #6563
Conversation
The zoomable previews (docx, pdf, pptx, image) bind `bindPreviewWheelZoom`, whose horizontal branch maps a trackpad's `deltaX` — and Shift+`deltaY` on a plain mouse — onto the container's `scrollLeft`. The tabular previews never bound anything, which did not matter while their table fitted the frame. Now that it is wider, a mouse whose wheel reports only `deltaY` can reach the overflow solely by dragging the scrollbar; hovering the table and scrolling does nothing sideways. Extract that horizontal branch into `bindPreviewHorizontalWheel`, sharing the delta logic with the zooming variant rather than duplicating it, and bind it in all three tabular preview containers through a `useHorizontalWheelScroll` ref callback. The new binder deliberately ignores ctrl/cmd+wheel so browser page zoom still works over a table, since these previews have no zoom of their own.
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Extracts shared horizontal-wheel handling into Reviewed by Cursor Bugbot for commit f987a15. Configure here. |
Uh oh!
There was an error while loading. Please reload this page.
Cancelling a wheel event is all-or-nothing, so applying only `scrollLeft` after `preventDefault` dropped a diagonal trackpad pan's `deltaY` entirely. Apply the vertical component too, except under Shift, which remaps `deltaY` onto the horizontal axis and so has none left to spend.
waleedlatif1
commented
Aug 11, 2026
waleedlatif1
commented
Aug 11, 2026
@cursor review |
Greptile SummaryThe PR adds horizontal wheel handling to CSV and XLSX preview containers while preserving native vertical scrolling and browser zoom behavior.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-wheel-zoom.ts | Extracts shared horizontal-wheel handling and correctly converts wheel delta units before updating scroll offsets. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/use-horizontal-wheel-scroll.ts | Adds a stable callback-ref hook that binds and cleans up the horizontal wheel listener with the preview node lifecycle. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-wheel-zoom.test.ts | Covers horizontal, shifted, diagonal, modifier-key, overflow, delta-mode, child-capture, and unbinding behavior. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/csv-table-preview.tsx | Attaches the horizontal-wheel callback ref to the CSV table’s scroll container using the required absolute import. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx | Attaches the horizontal-wheel callback ref to the inline CSV preview’s scroll container using the required absolute import. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/xlsx-preview.tsx | Attaches the horizontal-wheel callback ref to the XLSX table’s scroll container using the required absolute import. |
Reviews (3): Last reviewed commit: "fix(files): normalize wheel deltas to pi..." | Re-trigger Greptile
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…lutely A wheel delta is only in pixels when `deltaMode` says so — Firefox reports mouse wheels in lines — while scroll offsets always are, so a three-line notch moved the table three pixels. Convert line and page deltas before applying them.
waleedlatif1
commented
Aug 11, 2026
waleedlatif1
commented
Aug 11, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f987a15. Configure here.
Summary
deltaY— the horizontal overflow is reachable only by dragging the scrollbarbindPreviewWheelZoom, whose horizontal branch maps a trackpad'sdeltaX, and Shift+deltaYon a plain mouse, ontoscrollLeft. The tabular previews never bound anythingbindPreviewHorizontalWheel— sharing the delta logic with the zooming variant rather than duplicating it — and bound it in all three tabular preview containers (csv-table-preview,xlsx-preview,preview-panel'sCsvPreview) via auseHorizontalWheelScrollref callbackLatent until #6550: while the table was sized to the frame it never overflowed, so there was nothing to scroll. Independent of that PR though — the binder no-ops when
scrollWidth <= clientWidth, so it is inert until the table is actually wider.Type of Change
Testing
8 unit tests in
preview-wheel-zoom.test.tscovering trackpaddeltaX, Shift+wheel, plain vertical wheel (must stay vertical), ctrl/cmd passthrough, the no-overflow no-op, unbind, and capture from a child cell. Mutation-verified: 3 fail when the binder body is removed.jsdom does no layout, so the tests assert the handler's contract rather than real scrolling. Verified actual behavior separately with trusted wheel events in headless Chromium, hovering a table cell:
Not yet exercised in the running app.
Checklist