Skip to content

fix(core): remove unused source preview anchor - #3099

Open
RovshanMuradov wants to merge 1 commit into
TypeCellOS:mainfrom
RovshanMuradov:fix/remove-unused-preview-anchor
Open

RovshanMuradov wants to merge 1 commit into
TypeCellOS:mainfrom
RovshanMuradov:fix/remove-unused-preview-anchor

Conversation

@RovshanMuradov

@RovshanMuradov RovshanMuradov commented Sep 19, 2026

Copy link
Copy Markdown

Summary

Remove the unused source-preview CSS anchor to avoid excessive Chromium layout work with many math previews.

Fixes #3098.

Rationale

Every preview declares --bn-source-popup-anchor, but no current position-anchor, anchor(), or anchor-size() consumer uses it. Source popups use absolute positioning. Removing the leftover declaration avoids registering hundreds of unnecessary anchors; retaining it only while open adds state-dependent CSS without an internal consumer.

Changes

  • Delete anchor-name: --bn-source-popup-anchor from .bn-preview-container.

Impact

For 500 inline formulas, median cumulative layout falls from 17.610 → 0.437 s editable and 17.684 → 0.427 s read-only. Formula counts and DOM node counts are unchanged.

The anchor identifier is undocumented; downstream CSS explicitly targeting it would need adjustment.

Testing

  • Compared original, active-only, and removal production fixtures built from current source: 72 serial Chromium navigations, three runs per combination, 100/250/500 inline formulas and 100 block formulas, editable/read-only. No page errors. Both fixes eliminate the slowdown; no meaningful performance difference between them was established.
  • Chromium/Firefox standalone functional comparisons: inline/block math and a custom SourceBlockWithPreview, edit persistence, OK/Escape, popup switching, keyboard/focus, editable transitions, two-editor focus switching, scrolling, and narrow viewport. Recorded geometry, document content, and state match the original.
  • CSS formatting and git diff --check pass.
  • pnpm lint run as requested by CONTRIBUTING: 54 type errors and one warning on both the unchanged base and this patch, with identical diagnostic messages (including missing @blocknote/xl-typst-compiler declarations).

Screenshots/Video

Not applicable; no intended visual change. Reproduction and measurements are in #3098.

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

This is a one-line CSS cleanup with standalone browser verification; no new unit tests or public API documentation changes. The full monorepo build/unit/Docker E2E suites were not run. WebKit verification was blocked by missing host libraries.

Summary by CodeRabbit

  • Bug Fixes
    • Removed an obsolete anchor declaration from the preview container while preserving its clickable behavior.

@vercel

vercel Bot commented Sep 19, 2026

Copy link
Copy Markdown

@RovshanMuradov is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 9ad26edc-3f0d-4f82-8350-e16272185cd0

📥 Commits

Reviewing files that changed from the base of the PR and between 835fabf and 7362201.

📒 Files selected for processing (1)
  • packages/core/src/editor/Block.css
💤 Files with no reviewable changes (1)
  • packages/core/src/editor/Block.css

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change removes the unused CSS Anchor Positioning declaration from .bn-preview-container. The container remains clickable through its existing pointer cursor.

Changes

Preview layout performance

Layer / File(s) Summary
Remove unused preview anchor
packages/core/src/editor/Block.css
.bn-preview-container no longer declares anchor-name: --bn-source-popup-anchor. Its cursor: pointer declaration remains.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix · Severity of issue fixed: Medium

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: removing the unused source preview anchor declaration.
Description check ✅ Passed The description follows the required template and clearly documents the rationale, code change, impact, testing, limitations, and checklist status.
Linked Issues check ✅ Passed Issue #3098 requires preventing unused CSS-anchor layout work for .bn-preview-container source previews. The reviewed change removes anchor-name: --bn-source-popup-anchor from `packages/core/src/e…
Out of Scope Changes check ✅ Passed The whole-PR summary identifies one scoped change in packages/core/src/editor/Block.css: removal of the unused anchor declaration. The reported validation supports the performance objective in issue…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit finds an anchor unused
It hops away, no layout bruised
The preview still points with care
While lighter calculations fill the air
Math previews bloom, swift and bright

Comment @coderabbitai help to get the list of available commands.

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.

Chromium: excessive layout time with many math previews due to unused CSS anchor

1 participant