Repository navigation
fix data viewer multi-cell copy and horizontal scrollbar on tab return - #17804
Merged
Merged
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
kevinushey
added a commit
that referenced
this pull request
Jun 1, 2026
Moving these changes to a fresh branch via a file copy reverted three blocks that #17804 (#17800 fix) had landed on main, since the copied file predated that PR. Restore them: - showScrollbars() in onResize and window.onActivate - the multi-cell native-selection guard in onGridKeyDown's copy path Also address review feedback on the canvas sparkline: - return null when getContext("2d") yields no context, instead of a wrapper around an un-drawable canvas that still shows a hover tooltip - drop the empty .sidebar-sparkline placeholder when no sparkline is produced, so it doesn't reserve vertical space
kevinushey
added a commit
that referenced
this pull request
Jun 2, 2026
* fix slow data viewer when the summary panel is shown The summary sidebar built one SVG <rect> per histogram bin for every numeric column (hundreds of vector nodes across a wide frame) and never isolated the grid/sidebar onto their own paint layers. Scrolling the grid invalidated the root layer and forced all of those SVG sparklines to repaint each frame, producing multi-second stalls -- which is why turning the summary panel off restored responsiveness (#17806). - Add `contain: layout paint` to #gridViewport and #sidebarContent so the virtual-scroll DOM churn stays local and no longer repaints the sidebar. - Render each column's histogram to a single <canvas> instead of per-bin SVG <rect> nodes; the hover tooltip is preserved. - Defer sparkline drawing until the summary panel is actually visible, so a hidden panel never pays the rendering cost. Addresses #17806. * restore per-bar hover highlight in sparklines The canvas sparkline lost the SVG version's per-bar :hover highlight. Redraw the canvas on hover with the hovered bar at full opacity, tracking the hovered bin so it only repaints when the cursor crosses into a different bar, and clear it on mouse-leave. * restore #17804 changes clobbered by branch move; harden sparkline Moving these changes to a fresh branch via a file copy reverted three blocks that #17804 (#17800 fix) had landed on main, since the copied file predated that PR. Restore them: - showScrollbars() in onResize and window.onActivate - the multi-cell native-selection guard in onGridKeyDown's copy path Also address review feedback on the canvas sparkline: - return null when getContext("2d") yields no context, instead of a wrapper around an un-drawable canvas that still shows a hover tooltip - drop the empty .sidebar-sparkline placeholder when no sparkline is produced, so it doesn't reserve vertical space * data viewer: virtualize columns to fix wide-frame freeze Render only the columns intersecting the horizontal viewport (plus the always-rendered pinned columns), mirroring the existing row virtualization, with left/right spacer cells preserving the table's total width and scrollbar. Wide frames materialized ~200 columns x ~100 rows of cells in a single DOM write, and the compositor commit for that many cells stalled the main thread for several seconds. Purely client-side; the column-paging data contract is unchanged. Also restore a column's per-column filter display when its header is recreated as it scrolls back into the window, trim the row overscan, and add an e2e test covering the filter round-trip. Addresses #17806. * add PW_DEBUG harness for interactive renderer profiling PW_DEBUG opens Chromium DevTools on the dev desktop build and parks each test (via readline in the RStudio Console) so a human can arm the Performance profiler before the test drives its scenario. No-op without PW_DEBUG. Adds a rstudio-console-waiting-for-input class on the console input (set when R requests interactive input, e.g. readline/menu/scan) so the pause can tell 'waiting for the user' apart from 'idle' -- the console clears its busy state on any prompt. developer-only tooling; no user-facing behavior change. * desktop: enable middle-click autoscroll Enable the MiddleClickAutoscroll Blink feature, which Chrome and Firefox ship enabled by default but Electron does not -- so middle-click in scrollable areas (e.g. the data viewer) did nothing in RStudio Desktop. * data viewer: clear injected header-UI state on grid teardown activeHeaderUIs (the filter/column-type re-injection registry used as the column window slides) was module state that survived resetGridState, so it could re-inject header controls into a reset/refreshed grid even when the frontend considered them off. Clear it on teardown, and record header-UI visibility in postInitActions unconditionally so column-pagination persistence flows through that replay channel (the source of truth across bootstraps) rather than relying on the leaked registry. Addresses #17806 (roborev review). * e2e: de-flake the data viewer column-filter test The open-and-type relied on page.keyboard after the 'All' click's implicit focus, and the text filter auto-dismisses (reverts to 'All') if its input blurs while empty -- so a focus hiccup between opening and typing silently dropped the keystroke or closed the editor. Type through the input locator and retry the open-and-type as a unit until the value sticks; gate on the input value before the downstream filtered-row assertion. Stable across --repeat-each=5. * data viewer: memoize column offsets to cut per-row render cost columnOffsets() rebuilt an O(columns) prefix sum on every call, including once per rendered row in appendWindowedCells. Cache the result and invalidate it alongside the pinned-offsets cache (same columnOrder + measuredWidths dependencies), turning a full rebuild's offset work from O(rows x columns) into O(columns) per render pass.
This was referenced Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Addresses #17800.
Two regressions in the vanilla-JS data viewer (introduced by the rewrite in #17382):
Horizontal scrollbar disappears after returning to the tab. The grid uses auto-hide overlay scrollbars that fade after ~1.2s and only reappear on a scroll event. Returning to the data viewer tab re-ran layout (
onActivate) but never re-showed the bars, so the horizontal scrollbar stayed hidden -- and since horizontal scrolls rarely happen via the wheel, it was effectively gone until the user arrow-keyed a cell out of view.Ctrl/Cmd+C only copied the active cell. While the viewport is focused the grid intercepts copy to grab the single active cell, but it did so unconditionally and
preventDefault()ed the keystroke -- clobbering any multi-cell native text selection. Copying multiple cells only worked when the viewer was popped out to a separate window (where focus isn't forced onto the viewport).Changes
DataViewer.js: callshowScrollbars()fromonActivateandonResizeso the auto-hide bars resurface after a relayout (update()still leaves non-scrollable axes hidden).DataViewer.js: in the copy handler, defer to the browser's native copy when a non-empty selection exists; the single-active-cell copy remains the fallback when nothing is selected.Tests
Two Playwright tests added to
e2e/rstudio/tests/panes/data-viewer/data_viewer.test.ts(each fails on the pre-fix code):copycarrying both cellsvisibleclass after switching away and back to the viewer tabFull data viewer file is green (9/9) on Desktop;
npm run typecheckclean.