You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: smooth horizontal scrolling in wide data tables (#1544)
* fix: smooth horizontal scrolling in wide data tables
Fixes#1476 (duplicate: #1514). Three defects in center-column
virtualization made horizontal scrolling in wide tables jumpy, made the last
column unreachable, and snapped the viewport left when clicking a cell:
- The virtualization window was derived from a raw scroll-position state that
was updated behind a requestAnimationFrame hop, so every scrolled pixel
re-rendered the whole grid while the mounted window lagged the real scroll
position, showing blank columns and jumpy repaints. The window is now
computed synchronously in the scroll/resize handlers and stored in state
only when the set of mounted columns actually changes.
- The focused-cell auto-scroll effect re-ran on every scroll update while the
focused cell's element was not rendered (focused column outside the
virtualization window, or focused row not on the current page), re-applying
a column-aligned scrollLeft each time and fighting user scrolling. It now
runs at most once per focused-cell change and falls back to any rendered
cell in the focused row for the vertical reveal.
- The window was computed from scrollLeft shifted left by the pinned-column
width, under-rendering columns at the right viewport edge. Sticky pinned
columns occupy as much viewport as they occupy row start, so container
scrollLeft maps 1:1 onto center-column offsets.
Verified in the ppg demo against the 61-column all_data_types table: the
window follows scrolling to the very end, the last column renders fully, and
clicking or focusing cells no longer moves the viewport. Regression tests
cover the auto-scroll fight, animation-frame-free window updates, and
end-of-grid window coverage.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: address PR review feedback on virtualization key and pending focus
- Serialize the center-column virtualization inputs key structurally with
JSON.stringify instead of delimiter joining, so column ids containing the
delimiter characters cannot produce colliding keys.
- Keep a focused-cell auto-scroll pending while its prerequisites are missing
(no scroll container, unknown column, or an unmeasured/hidden grid) instead
of marking it handled up-front. Column changes and a new viewport-readiness
tick re-trigger the effect when layout becomes ready; neither signal changes
on plain scrolling, so the at-most-once-per-focus guarantee against fighting
user scrolling is preserved.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Fix broken horizontal scrolling in wide data tables. The column virtualization window now follows scrolling synchronously and only re-renders the grid when the set of mounted columns changes, so scrolling no longer jumps between columns and the last column is reachable. Focused-cell auto-scroll now runs at most once per focus change, so clicking a cell to edit no longer snaps the viewport back and off-screen focus targets no longer fight user scrolling. Also corrects the virtualization window offset when columns are pinned.
Copy file name to clipboardExpand all lines: FEATURES.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,6 +185,7 @@ The footer keeps page navigation, a page jump field, a fixed rows-per-page dropd
185
185
Rows-per-page and infinite-scroll preferences persist across tables through local storage, while the known filtered-row count keeps the footer stable during page transitions for the same filtered result set. Infinite scroll preloads before the hard bottom edge, always appends in fixed 25-row chunks regardless of the paginated page-size setting, keeps filling tall viewports until the grid is actually scrollable, and appends new rows in place without snapping the grid back to the top.
186
186
Row editing, deletion, and insertion operate on the same loaded row window the grid displays, so with infinite scroll enabled staged cell edits save correctly even for rows loaded beyond the first 25-row batch.
187
187
Rapid sort and filter changes keep the latest request authoritative, and superseded table reads are aborted so a slower older result cannot overwrite the visible grid.
188
+
Wide tables virtualize their non-pinned columns so only the columns near the viewport are mounted. The virtualization window follows horizontal scrolling synchronously and grid re-renders only happen when the set of mounted columns actually changes, which keeps horizontal scrolling smooth, makes the last column reachable, and lets cell focus changes reveal off-screen columns without fighting user-initiated scrolling.
0 commit comments