Repository navigation
Only remember sticky scroll mouse targets inside the widget - #337855
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits intoSep 25, 2026
Merged
Conversation
Every StickyScrollController stored the target of every mousemove in the window, which retained arbitrary DOM nodes, e.g. of an editor view that got detached afterwards. Only targets inside the sticky scroll widget are used. Related to #146841 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The leak fix is focused and correct; only a minor comment-format issue remains.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Limits sticky-scroll mouse tracking to widget-owned elements, preventing detached editor DOM retention.
Changes:
- Filters global mouse targets using the sticky-scroll widget boundary.
- Clears the stored target when the pointer is elsewhere.
| File | Description |
|---|---|
stickyScrollController.ts |
Restricts retained mouse targets to sticky-scroll DOM. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
September 25, 2026 01:36
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 25, 2026 01:36
Paul (pwang347)
approved these changes
Sep 25, 2026
Dmitriy Vasyura (dmitrivMS)
deleted the
agents/leak-sticky-scroll-mouse-target
branch
September 25, 2026 01:55
Abdon Morales (abdonmorales)
pushed a commit
to abdonmorales/vscode-utcs
that referenced
this pull request
Sep 27, 2026
…t#337855) * Only remember sticky scroll mouse targets inside the widget Every StickyScrollController stored the target of every mousemove in the window, which retained arbitrary DOM nodes, e.g. of an editor view that got detached afterwards. Only targets inside the sticky scroll widget are used. Related to microsoft#146841 Co-authored-by: Copilot <[email protected]> * Condense sticky scroll mouse target comment Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> (cherry picked from commit e182159)
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Related to #146841
Every
StickyScrollController(one per code editor) listened tomousemoveon the main window and storedmouseEvent.targetin_mouseTarget— for any element in the window. When the element under the mouse was part of an editor view that got detached afterwards (e.g. the tab was switched with the keyboard), every sticky scroll controller kept that span and, through its parent chain, the complete detached view alive until the mouse moved again._mouseTargetis only used to find the hovered sticky line, so only targets inside the sticky scroll widget are remembered now.Retainer path (heap snapshot):
StickyScrollController._mouseTarget → <span class="mtk21"> → <span> → view-line → view-lines → … → <div class="monaco-editor">Measurement
Bounded (one tree, released on the next mouse move), but independent of which editor had the controller: every open editor's controller retained it.
How this was measured
Code OSS (Electron, dev build) driven over CDP with Playwright. After each scenario: 4× forced GC, then
DOM.getDetachedDomNodes(the data behind Edge's Detached Elements tool), counting the descendants of every detached root. "Without this change" means all other fixes from this series applied and only this one reverted, so the number shows what this retainer alone keeps alive. Each scenario was run 3 times with identical results. The retainer was identified from a heap snapshot retainer path.