Fix frozen wheel/trackpad scroll on Chromium >=145 (VS Code 1.123+) + stop per-render re-render of all comment decorators - #20
Open
pettipol wants to merge 2 commits into
Conversation
… (VS Code 1.123+) .mdx-content was declared as a nested scroll container (overflow-y: auto) with overscroll-behavior: contain, while its scrollable extent is zero — the real scroller is .mdxeditor-root-contenteditable. Since Chromium ~145 (css-overscroll spec alignment, 'Respect overscroll-behavior on non-scrollable scroll containers', shipped in M144-145) a container with overscroll-behavior != auto cuts the scroll chain even when it cannot scroll: wheel gestures latch onto .mdx-content and die there, so the document no longer scrolls at all in VS Code 1.123 (Electron 42 / Chromium 148). Scrollbar drag still works; source mode is unaffected (CodeMirror has its own scroller). Empirical bisect (trusted wheel events on a replica of this CSS cascade): Chrome 129/140 scroll 1000/1000px, Chrome 145 0px, Chrome 148 17/1000px. With this patch, full document depth is reachable again on Chrome 148. Changes: - drop overflow-y:auto and overscroll-behavior:contain from .mdx-content (it must not be a scroll container; search/TOC code already targets the wrapper as the scroller) - remove [contenteditable='true'] from the blanket containment group, which re-applied overscroll-behavior:contain with !important to the same element. Containment toward the VS Code workbench remains guaranteed by the body rule and by the real scroller rule. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…churn Object.keys(fontFamilyMap) was evaluated on every render of usePlugins, giving availableFonts a new identity each time. That invalidated the plugins useMemo on every render, and RealmWithPlugins runs plugin.update() on each render: commentsPlugin re-published a fresh directiveDescriptors array, re-rendering every :comment decorator (including their NestedLexicalEditor instances) on every click/selection change. On large documents with many comments this saturates the main thread — the hot path behind jonnyasmar#11. fontFamilyMap is a module-level constant, so its key list is too. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #19 — and the second commit addresses the hot path behind #11.
What
Two focused commits:
1.
fix:scroll freeze on Chromium ≥145 (VS Code 1.123+) — CSS only..mdx-contentwas a zero-extent nested scroll container (overflow-y: auto+overscroll-behavior: contain, the latter re-applied with!importantby the blanket[contenteditable='true']rule). Since Chromium M144 ("Respect overscroll-behavior on non-scrollable scroll containers", https://developer.chrome.com/release-notes/144) such a container cuts the scroll chain even though it cannot scroll, so wheel/trackpad gestures die before reaching the real scroller (.mdxeditor-root-contenteditable). Full analysis and Chromium bisect (140 OK → 145 frozen → 148 frozen) in #19.Containment toward the VS Code workbench is preserved: the
bodyrule and the real scroller rule keepoverscroll-behavior: contain.2.
perf:hoistavailableFontsto module scope — one-line identity fix.Object.keys(fontFamilyMap)ran on every render ofusePlugins, giving the array a fresh identity each time → the pluginsuseMemoinvalidated on every render →RealmWithPluginsrunsplugin.update()per render →commentsPluginre-published a freshdirectiveDescriptorsarray → every:commentdecorator (and its NestedLexicalEditor) re-rendered on every click/selection change. On large documents with many comments this saturates the main thread — consistent with the report in #11.fontFamilyMapis a module-level constant, so its key list can be too.Testing
:commentinsertion via floating button, comment-sidebar click → scroll-to-highlight, Cmd+F search → scroll-to-match all work (they already target the wrapper as the scroller).npm run packagebuilds clean; the two commits touch onlyMDXEditorWrapper.cssandusePlugins.tsx(no version/manifest changes).🤖 Generated with Claude Code