Skip to content

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
jonnyasmar:mainfrom
pettipol:fix/scroll-freeze-chromium-145
Open

Fix frozen wheel/trackpad scroll on Chromium >=145 (VS Code 1.123+) + stop per-render re-render of all comment decorators#20
pettipol wants to merge 2 commits into
jonnyasmar:mainfrom
pettipol:fix/scroll-freeze-chromium-145

Conversation

@pettipol

Copy link
Copy Markdown

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-content was a zero-extent nested scroll container (overflow-y: auto + overscroll-behavior: contain, the latter re-applied with !important by 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 body rule and the real scroller rule keep overscroll-behavior: contain.

2. perf: hoist availableFonts to module scope — one-line identity fix.
Object.keys(fontFamilyMap) ran on every render of usePlugins, giving the array a fresh identity each time → the plugins useMemo invalidated on every render → RealmWithPlugins runs plugin.update() per render → commentsPlugin re-published a fresh directiveDescriptors array → every :comment decorator (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. fontFamilyMap is a module-level constant, so its key list can be too.

Testing

🤖 Generated with Claude Code

pettipol and others added 2 commits June 10, 2026 12:59
… (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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rich-text editor scroll completely frozen on VS Code 1.123+ (Chromium 148): .mdx-content overscroll-behavior cuts the scroll chain since Chromium 145

1 participant