Skip to content

perf: skip a notebook-wide restyle when opening the command palette - #12257

Merged
kirangadhave merged 1 commit into
mainfrom
kg/mo-8797-trace-mod-k-restyle
Dec 3, 2026
Merged

kirangadhave merged 1 commit into
mainfrom
kg/mo-8797-trace-mod-k-restyle

Conversation

@kirangadhave

@kirangadhave kirangadhave commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

📝 Summary

Opening the command palette on a page with no scrollbar gap made Chrome recalculate styles across the notebook. Set --removed-body-scroll-bar-size to 0px in the editor HTML so the scroll lock keeps the same inherited value. The same rule in the external stylesheet still triggered the restyle in production.

In eight paired headless Chromium runs on a settled 500-cell notebook with two mounted editors, this skipped a style update across 34,165 elements. Median time from Mod-K to the first visible-frame marker fell from 225 ms to 134 ms. Every pair improved by 83–98 ms. Keyboard Shortcuts kept one wide style update and showed no consistent speedup.

Verified keyboard navigation, focus restoration, accessibility-tree exclusion, nested dialogs, background pointer and wheel blocking, and compensation for a 15 px scrollbar.

Related to MO-8797.

Give the body the same zero gap that the scroll lock applies when the
page has no scrollbar. Keeping the rule inline avoids a full style
update in Chromium. A nonzero scrollbar gap still takes precedence.
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 878726a.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./frontend

Status Category Percentage Covered / Total
🔵 Lines 69.22% 28681 / 41430
🔵 Statements 69.17% 29236 / 42262
🔵 Functions 64.53% 6893 / 10681
🔵 Branches 64.64% 16808 / 26000
File CoverageNo changed files found.
Generated in workflow #26516 for commit 878726a by the Vitest Coverage Report Action

@kirangadhave
kirangadhave marked this pull request as ready for review December 3, 2026 01:52
@kirangadhave
kirangadhave requested review from mscolnick and a balanced review from Copilot December 3, 2026 01:53
@kirangadhave
kirangadhave enabled auto-merge (squash) December 3, 2026 01:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the inline scrollbar-gap default change.

No open issues 🎉

What changed in this PR

Reduces command-palette opening overhead by avoiding a notebook-wide style recalculation when there is no scrollbar gap.

Changes:

  • Initializes --removed-body-scroll-bar-size to 0px in an inline body style in the editor HTML.
File Description
frontend/​index.html Adds the inline scrollbar-gap default to avoid unnecessary restyling.

Review effort: Balanced

@kirangadhave
kirangadhave merged commit 206366f into main Dec 3, 2026
32 checks passed
@kirangadhave
kirangadhave deleted the kg/mo-8797-trace-mod-k-restyle branch December 3, 2026 04:54
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.

3 participants