Skip to content

keep the data viewer's frozen pane on the viewport's scroll range - #18812

Merged
kevinushey merged 3 commits into
mainfrom
bugfix/18620-pinned-pane-gutter
Sep 15, 2026
Merged

kevinushey merged 3 commits into
mainfrom
bugfix/18620-pinned-pane-gutter

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

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 maximum scrollTop ends a gutter short. syncPinnedScrollTop clamps it early at the bottom, and onPinnedScroll's "is the frozen pane already clamped?" check compares a fractional scrollTop against integer scrollHeight - 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 from applyPinnedColumns, 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.
  • The clamp check gets a pixel of slack for the whole-pixel measurement of a fractional layout.

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

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

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 gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — the margin-bottom inset 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.

Comment on lines +4034 to +4036
var marginBottom = gutter > 0 ? gutter + "px" : "";
if (pinnedPane.style.marginBottom !== marginBottom)
pinnedPane.style.marginBottom = marginBottom;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

Suggested change
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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
2967 0 196 4
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
✅ desktop-linux 749 0 38 0
✅ desktop-macos 744 0 42 2
✅ desktop-windows 750 0 42 1
✅ server-linux 694 0 44 1
✅ setup 28 0 20 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit e417c347ea09dbc5d8e7a182236721368f667b20 - Run #1024

kevinushey and others added 2 commits September 15, 2026 14:02
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.
@kevinushey
kevinushey merged commit f8dfc3a into main Sep 15, 2026
1 of 6 checks passed
@kevinushey
kevinushey deleted the bugfix/18620-pinned-pane-gutter branch September 15, 2026 21:05
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:19 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:19 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:21 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:21 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:23 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:23 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:29 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:29 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:29 — with GitHub Actions Active
@kevinushey
kevinushey deployed to e2e-playwright September 15, 2026 21:29 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
e2e-playwright — e417c347 Deployed Sep 15, 2026 by kevinushey via windows / e2e-desktop-windows (3) #1024
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.

Data Frame View Window "bounces" when you scroll all the way to the bottom of the data frame in a large data frame

2 participants