Repository navigation
keep the git peek's close button clear of the editor scrollbar - #19587
Conversation
Ace's vertical scrollbar element is wider than the room Ace keeps for it (by all 20px with overlay scrollbars), so it covered the close button at the end of the peek and took its clicks. Addresses #19576
RStudio E2E - all platformsAll tests passed!
All platforms - commit |
gtritchie
left a comment
There was a problem hiding this comment.
The fix itself checks out against Ace's scrollbar and line-widget code. The requested changes are to NEWS.md; the rest is smaller.
NEWS.md (pre-existing, but it sets the release boundary this entry relies on). The 2026.12.0 ### New section (lines 7-12) repeats all six ### New entries of 2026.11.0 (version/news/os/NEWS-2026.11.0-montauk-daisy.md on rel-montauk-daisy):
- #19166, #19114 and #19142 match the 2026.11 entries word for word, so they can go.
- #12622, #2846 and #19208 are the 2026.11 entries edited in place after the branch (by #19158 and #19350) to describe follow-up work. As written, the 2026.12 notes present the gutter markers and the side-by-side view as new again. Each could become an entry for just what 2026.12 adds: the status-bar change count, the Git pane go-to-change button, the toolbar toggle, the pane headers and the side-by-side revert bar, and, for #12622, the install destination confirmation and the nearby-version alternative.
Could you fix those here, or in a separate PR?
Comments are inline.
| - ([#19241](https://github.com/rstudio/rstudio/issues/19241)): The Console notice shown at startup when RStudio reduces background file operations for a project can now be turned off with the `show_reduced_file_operations_notice` preference (e.g. from the Command Palette), or for all users by an administrator with `"show_reduced_file_operations_notice": false` in `rstudio-prefs.json`. | ||
|
|
||
| ### Fixed | ||
| - ([#19576](https://github.com/rstudio/rstudio/issues/19576)): Fixed an issue where the close button of a Git change opened from the editor gutter, or of its action bar in the side-by-side view, could not be clicked in a document long enough to scroll when scrollbars take up no room (as macOS's overlay scrollbars do): the editor's scrollbar area covered it. |
There was a problem hiding this comment.
Only half of this is a released bug. In 2026.11 (rel-montauk-daisy) the gutter peek has its close button at the end of the header (margin-left: auto, fixedWidth: true), so that part shipped. The side-by-side action bar came in #19350 (dd65ab2, 2026-11-04), after the branch; in 2026.11 a side-by-side marker click only moves the cursor. Per the repo's CLAUDE.md, fixes to unreleased features don't get a NEWS entry, so please drop "or of its action bar in the side-by-side view".
There was a problem hiding this comment.
Agreed. In 2026.11, showPeek returns early whenever a side-by-side view is attached, so the action bar never shipped. Dropped in 5d8ab12.
| // and the peek's height follows; Ace measures it again in this frame. | ||
| // (The action bar has no label to wrap.) | ||
| peek.headerHeight = null; | ||
| if (!peek.compact) |
There was a problem hiding this comment.
This remeasures the peek when the scrollbar cover changes, but the label also wraps when the editor's width changes (dragging the pane splitter), and nothing remeasures it then. Ace's measureWidgets only measures widgets in _changedWidgets, and RStudio's syncLineWidgetHeights only runs from AceEditor.setFontSize. So rowCount stays at the old height and the taller peek overlaps the lines below it.
That gap predates this PR, but the new test works around it: git_diff_test.html calls onWidgetChanged(peekWidget) itself after narrowing #live (line 262). Calling onWidgetChanged for a non-compact peek from pinPeek whenever peek.headerWidth !== scrollerWidth (the check it already does) would cover resizes and the scrollbar case together, and the test wouldn't need the manual call.
There was a problem hiding this comment.
Agreed; fixed in 2ca2bce. The check is now fitPeek. It compares the scrollbar's cover and $size.scrollerWidth with what the peek was last laid out for, and hands a non-compact peek back to Ace when either changes. It still runs from pinPeek, and also from a capturing beforeRender listener ahead of measureWidgets. Since onResize updates scrollerWidth before it renders, a resize is measured in the render that lays it out. pinPeek's header-height cache no longer tracks the width itself; fitPeek resets it.
The testpage no longer calls onWidgetChanged itself. It now widens and narrows the editor through the render loop and checks rowCount one frame later; the widening check fails without the change.
| peek.closeButton.style.marginRight = (cover > 0) ? cover + "px" : ""; | ||
|
|
||
| // In a narrow editor the label wraps around the button's new place, | ||
| // and the peek's height follows; Ace measures it again in this frame. |
There was a problem hiding this comment.
"Ace measures it again in this frame" holds only for synchronous renders (e.g. resize(true)). When this runs from pinPeek during a render-loop pass (typing, scrolling), RenderLoop._flush has already set pending = false, so updateFull() -> $loop.schedule calls requestAnimationFrame again, and measureWidgets runs in the next frame. One frame is painted with the old rowCount, so a freshly wrapped label briefly overlaps the line below. Either the comment should say so, or the fix above (remeasuring before the widgets are positioned) avoids it.
There was a problem hiding this comment.
Right. With the beforeRender hook in 2ca2bce, resizes are measured in the same render. A scrollbar that appears or goes, or a gutter that changes width, still changes during the render ($computeLayerConfig, onGutterResize), after measureWidgets has run. Those are queued from pinPeek and measured in the next frame. The comment on fitPeek now says one frame shows the old height in that case.
| this.lineWidgetManager().addLineWidget(widget); | ||
| this.peek = { chunk: chunk, widget: widget, compact: compact }; | ||
| this.peek = { chunk: chunk, widget: widget, compact: compact, closeButton: closeButton }; | ||
| this.clearPeekOfScrollbar(); |
There was a problem hiding this comment.
Minor: addLineWidget has already measured the widget and queued onWidgetChanged by this point. Because scrollBarCover starts out undefined, this first call always queues a second one, even when the cover is 0. Setting closeButton.style.marginRight while building el would let Ace's first measurement include the margin, and the first-call case would go away.
There was a problem hiding this comment.
Fixed in 2ca2bce. showPeek sets the margin before addLineWidget and records the cover and width on the peek, so the first fitPeek finds nothing changed.
| // scrollbars take no room (as in this runner's headless chromium, and | ||
| // with macOS's overlay scrollbars), and would take the clicks meant | ||
| // for the close button there (#19576). | ||
| review.dispose(); |
There was a problem hiding this comment.
These checks close the side-by-side view first, so the compact action bar, the case the e2e test in the issue fails on, has no testpage coverage. A check with review attached (close button clear of the scrollbar and taking clicks, with the alignment padding unchanged) would cover the compact branch of clearPeekOfScrollbar without depending on the machine's scrollbar style.
There was a problem hiding this comment.
Added in 2ca2bce, with the side-by-side view attached: a deletion at the end of the document, whose bar takes on the 3 rows of padding. It checks that the close button is clear of the scrollbar and takes clicks, before and after the scrollbar goes and comes back, and that the bar keeps its rows and the sides stay level. Removing the !peek.compact guard fails the padding and level checks.
| editor.resize(true); | ||
| await rendered(); | ||
| var spare = closeButton.getBoundingClientRect().left - revertButton.getBoundingClientRect().right; | ||
| live.style.width = (live.offsetWidth - spare + 10) + "px"; |
There was a problem hiding this comment.
Nit: live.style.width and label.style.lineHeight are never restored (only live.style.height is). Nothing runs after this block today, but a check added later would start with a narrowed editor and a wrapped peek. Resetting the width and calling editor.resize(true) at the end would avoid that.
There was a problem hiding this comment.
Done in 2ca2bce. The block now resets the label's line height and the editor's width and renders again at the end.
The label also wraps when a pane is resized, and nothing measured the peek then. The check now runs ahead of Ace's measureWidgets as well as after the render, so a resize is measured in the render that lays it out, and the close button's margin is set before Ace first measures the widget. The testpage covers the side-by-side action bar and restores the editor's width and the label's line height. Addresses #19576
gtritchie
left a comment
There was a problem hiding this comment.
Thanks. All six inline points are addressed. Fixing the 2026.12 NEWS duplicates in a separate PR is fine.
Intent
Fixes #19576.
In a document long enough to scroll, the close button (×) of a Git change opened from the editor gutter, and of its action bar in the side-by-side view, could not be clicked when scrollbars take up no room, as macOS's overlay scrollbars do (the default with a trackpad). The click landed on the editor's scrollbar instead. Escape still closed it.
This is what fails "keeps the sides level with the action bar open by a chunk's output" in
git_diff_gutter.test.tson macOS. The issue guessed that full-width scrollbars were the trigger; it is the other way round. The test passes with full-width scrollbars (Linux CI, or a Mac with a mouse connected) and fails with overlay scrollbars.Approach
The bar is an Ace line widget with
fixedWidth: true, which Ace ends where the room it keeps for the vertical scrollbar starts (scrollBar.getWidth()). The scrollbar's element is wider than that room: Ace makes it(width || 15) + 5px wide, so it overlaps the widget by 5px with 15px scrollbars, and by all 20px when the measured scrollbar width is 0. The close button sits 8px from the widget's end, which clears 5px but not 20px.GitDiffGutternow gives the close button a right margin equal to that overlap whenever the vertical scrollbar is showing, and takes it away when the scrollbar goes. It runs when the peek opens and on each render (the scrollbar comes and goes with the document's height); the overlap is read from the width Ace set on the element's style, so nothing is measured per frame.Two consequences worth knowing:
The fix is in the peek rather than in Ace: with overlay scrollbars Ace means content to run under the scrollbar, and the widget's background still does. Only the control at its end needed to move.
Automated Tests
src/gwt/test/git_diff_test.html(run byant testpage, in headless chromium, where scrollbars take no room) gains checks on a real editor and gutter:The first and third fail without the change.
The e2e test named in the issue needs overlay scrollbars to fail, which depends on the machine. Run locally on macOS with
test:desktop-dev, forcing them for the Electron process:Before the change that test fails with the error in the issue; after it, the whole file passes with overlay scrollbars and with full-width ones.
QA Notes
On macOS, set System Settings > Appearance > Show scroll bars to "When scrolling" (or use a trackpad with no mouse connected and the default "Automatically based on mouse or trackpad").
Before the fix the × did nothing in steps 2 and 3. With "Always" selected for scroll bars, both worked before and still do.
Documentation
None needed.
Checklist
NEWS.md