Fix notebook scrolling in web mode#13558
Merged
Merged
Conversation
In web-hosted Positron, the monaco-workbench element's wheel event listener calls preventDefault() during the bubble phase, which blocks native scrolling on the notebook cells container. In Electron this doesn't occur because the workbench's ScrollableElement short-circuits when it has nothing to scroll. Add stopPropagation() on wheel events at the cells container so they never reach the workbench handler, restoring native overflow:auto scrolling in web mode.
Explain why the handler runs unconditionally (harmless in Electron) and why the empty dependency array is safe (container DOM node is stable for the component lifetime).
|
E2E Tests 🚀 |
The previous comment incorrectly attributed the behavior to a ScrollableElement short-circuit. The real cause is BrowserWindow (window.ts:271) registering an unconditional preventDefault() on all wheel events on mainContainer to block macOS back/forward gestures. This listener only exists in the web build; NativeWindow (Electron) has no wheel handler at all.
dhruvisompura
approved these changes
May 14, 2026
Contributor
dhruvisompura
left a comment
There was a problem hiding this comment.
Fix worked for me on a web build!
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.
In web-hosted Positron the workbench's
monaco-scrollable-elementancestor callspreventDefault()on wheel events during the bubble phase, which blocks native scrolling on the notebook cells container. In Electron this doesn't manifest because the workbench'sScrollableElementshort-circuits when it detects it has nothing to scroll.This PR fixes this by adding a
stopPropagation()on wheel events at the cells container boundary so they never reach the workbench handler, restoring nativeoverflow: autoscrolling in web mode. Applied unconditionally since it's harmless in Electron (the ancestor already skipspreventDefaultwhen it has no overflow).References
Root cause:
src/vs/workbench/browser/window.ts:271-- theBrowserWindowwheel listener that callspreventDefault()on all wheel events onmainContainer. Only exists in web build.src/vs/workbench/electron-browser/window.ts:84--NativeWindow(Electron equivalent) has no wheel handler, which is why this only affects web mode.Why CSS alone can't fix it:
src/vs/workbench/browser/media/style.css:70-73--.monaco-workbench.webalready hasoverscroll-behavior: none, but that only prevents scroll-chaining, notpreventDefault()canceling native scroll.The fix (stopPropagation pattern):
src/vs/workbench/contrib/positronNotebook/browser/PositronNotebookComponent.tsx:106-119-- the fix itselfsrc/vs/workbench/contrib/positronConnections/browser/components/newConnectionModalDialog/createConnectionState.tsx:190-196-- same pattern already in use for the same reason, with a comment linking to the root causeScroll mechanics for context:
src/vs/base/browser/ui/scrollbar/scrollableElement.ts:424-- ScrollableElement registers with{ passive: false }(same mechanism the workbench listener uses to block scrolling)src/vs/workbench/contrib/positronNotebook/browser/PositronNotebookComponent.css:101-- the cells container uses nativeoverflow: autoRelease Notes
New Features
Bug Fixes
Validation Steps
@:positron-notebooks @:web