Repository navigation
keep the data viewer's frozen pane on the viewport's scroll range - #18812
Conversation
With overlay scrollbars off, the viewport's native horizontal scrollbar takes a gutter out of its clientHeight that the frozen row-number pane does not have, so the frozen pane's vertical scroll range ended a gutter short. syncPinnedScrollTop clamped it early at the bottom, leaving the row labels a row out of step with the data, and onPinnedScroll's clamp check -- a fractional scrollTop against rounded geometry -- failed under 125% display scaling, yanking the viewport back under the bar on every wheel tick. Inset the frozen pane by the measured gutter so both panes share one range, and give the clamp check a pixel of slack. Addresses #18620.
gtritchie
left a comment
There was a problem hiding this comment.
No blocking issues. 1 follow-up.
🟠 is real but not merge-blocking — either address it here or open an issue to do so later.
- 🟠
src/cpp/session/resources/grid/DataViewer.js:4034— themargin-bottominset shrinks the frozen pane's hit area, so the wheel stops working in the bottom gutter-height strip
I checked the core fix against a reduced copy of the pane layout with a 15px layout-taking horizontal bar: the frozen pane's max scroll was 1700 against the viewport's 1715 before the inset and 1715 = 1715 after it, with the row labels aligned to 0px at maximum scroll. I also traced applyScrollbarMode in both switch directions at maximum scroll; both converge with the panes aligned. No correctness problems found there or in the pinnedMax - 1 slack.
| var marginBottom = gutter > 0 ? gutter + "px" : ""; | ||
| if (pinnedPane.style.marginBottom !== marginBottom) | ||
| pinnedPane.style.marginBottom = marginBottom; |
There was a problem hiding this comment.
🟠 The margin-bottom inset shrinks the frozen pane's box, so the bottom ~15px of it stops responding to the wheel and to middle-click autoscroll.
| var marginBottom = gutter > 0 ? gutter + "px" : ""; | |
| if (pinnedPane.style.marginBottom !== marginBottom) | |
| pinnedPane.style.marginBottom = marginBottom; | |
| var padding = gutter > 0 ? gutter + "px" : ""; | |
| if (pinnedPane.style.paddingBottom !== padding) | |
| pinnedPane.style.paddingBottom = padding; |
Why
In native-scrollbar mode that strip now belongs to #gridPanes, not #pinnedPane — document.elementFromPoint there resolves to #gridPanes with margin-bottom, and to a pinned cell with padding-bottom. #gridPanes, #gridPanel and body are all non-scrollable (overflow: hidden, plus overscroll-behavior: none on the root), so a wheel over that corner scrolls nothing where it previously reached onPinnedWheel / onPinnedScroll, and a middle-click there no longer reaches onPinnedMouseDown to start autoscroll.
Bottom padding lands in a scroll container's scrollable overflow, so it gives the same shared range without shrinking the box. On the same probe (a 300px pane, 100 rows, a 15px layout-taking bar), padding-bottom: 15px gave pinnedMax 1715 == viewportMax 1715, against 1700 with no inset, and the last row stayed aligned at maximum scroll. It also keeps the pane's border-right separator running the full height instead of stopping a gutter short.
The e2e assertions would need to read paddingBottom instead of marginBottom.
Not merge-blocking: the affected area is a 15px corner next to the horizontal scrollbar, and the rest of the grid still scrolls normally.
There was a problem hiding this comment.
Agreed, thanks. Switched to padding-bottom in daba08e (and the e2e helper now reads paddingBottom). I checked it in headless Chromium, Firefox and WebKit: padding gives the same frozen-pane scroll max as the margin did, and the bottom strip now takes the wheel again instead of falling through to #gridPanes.
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
A bottom margin shrank the pane's box, so the strip beside the native horizontal scrollbar stopped taking wheel and middle-click autoscroll. Bottom padding extends the scroll range by the same amount instead. Addresses #18620.
Intent
Fixes #18620.
The overscroll tail from #18652 fixed the last row hiding under the custom horizontal scrollbar, but with "Use overlay scrollbars" turned off the reporter still sees the grid snap back up as soon as it reaches the bottom (video in the issue), and at the bottom the row numbers sit a row out of step with the data.
Approach
The frozen row-number pane and the body viewport are synced scrollers with different vertical ranges. The viewport always overflows horizontally (the overscroll padding is applied even when every column fits), so in native mode its horizontal scrollbar takes a 14-17px gutter out of
clientHeight; the frozen pane has no gutter, so its maximumscrollTopends a gutter short.syncPinnedScrollTopclamps it early at the bottom, andonPinnedScroll's "is the frozen pane already clamped?" check compares a fractionalscrollTopagainst integerscrollHeight - clientHeight. Under non-integer display scaling (Windows at 125%) the clamped value reads e.g. 681.5 against a computed max of 682, the check fails, and the viewport is set back to the frozen pane's position, i.e. yanked under the bar. Windows' animated wheel then fights that every frame, which is the multi-row bounce in the video.syncPinnedPaneGutter(run fromapplyPinnedColumns, whose padding decides the horizontal overflow) insets the frozen pane by the viewport's measured gutter so both panes share one scroll range: no early clamp, and the row labels stay aligned at maximum scroll. Zero in overlay mode and wherever the platform floats native bars.Reproduced and verified with headless Chromium at a forced 1.25 device scale factor and layout-taking native scrollbars: before, each wheel tick that reached the bottom was followed a frame later by a 14.5px pull-back to the frozen pane's position; after, both panes end at the same maximum with no pull-backs.
Automated Tests
The native-scrollbar half of the existing #18620 e2e test now asserts that the frozen pane's inset equals the viewport's gutter, that the two panes' maxima and bottom offsets match, that the position settles under further wheeling, and that the inset is dropped again on switching back to overlay mode. The settle check is shared with the overlay-mode test. The fractional-offset trigger itself does not occur in CI, but the shared range removes the early clamp it depended on.
QA Notes
On Windows at 125% or 150% display scaling, open the data viewer's toolbar options menu and uncheck "Use overlay scrollbars", then
View()a frame of 100,000 rows and wheel to the bottom. The last row should stay visible above the horizontal scrollbar, the row numbers should line up with the data, and further wheeling should not move the grid back up. Switching the option back on should behave as before.Documentation
None; behavior fix.
Checklist
NEWS.md