Repository navigation
[lexical][lexical-rich-text] Bug Fix: Show block cursor before block decorators regardless of preceding sibling - #8888
Merged
etrepum merged 2 commits intoJul 30, 2026
Conversation
ochevallier
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
July 29, 2026 11:44
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
need to fix e2e tests... |
Contributor
Author
|
e2e fixed : Problem : The original e2e test used Solution : Fixed by removing the |
etrepum
approved these changes
Jul 30, 2026
Merged
psoldunov
added a commit
to ensemblr-hq/ensemblr-electron
that referenced
this pull request
Sep 12, 2026
Bumping `lexical` alone left `@lexical/react` on ^0.49.0, which pins its own nested `[email protected]` — 23 duplicate copies across the `@lexical/*` tree. Two copies of the package means two structurally identical but nominally distinct `EditorState` types, so `npm run typecheck` failed on every call that passes one across the boundary, and the composer editor tests failed with it. Move the React bindings in step. The lockfile drops all 23 nested copies. Lexical 0.50 also wraps a block decorator in zero-size decorator boundary anchors (`<img data-lexical-decorator-boundary>`, absolutely positioned at 0x0, meta/lexical#8888), so the two tests that assert the editable root's children now skip them. They contribute no line box, so the composer's layout is unchanged. Co-authored-by: Ensemblr <[email protected]>
psoldunov
added a commit
to ensemblr-hq/ensemblr-electron
that referenced
this pull request
Sep 12, 2026
* chore(deps): bump lexical from 0.49.0 to 0.50.0 Bumps [lexical](https://github.com/facebook/lexical/tree/HEAD/packages/lexical) from 0.49.0 to 0.50.0. - [Release notes](https://github.com/facebook/lexical/releases) - [Changelog](https://github.com/facebook/lexical/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/lexical/commits/v0.50.0/packages/lexical) --- updated-dependencies: - dependency-name: lexical dependency-version: 0.50.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * fix(deps): move @lexical/react to 0.50.0 with lexical Bumping `lexical` alone left `@lexical/react` on ^0.49.0, which pins its own nested `[email protected]` — 23 duplicate copies across the `@lexical/*` tree. Two copies of the package means two structurally identical but nominally distinct `EditorState` types, so `npm run typecheck` failed on every call that passes one across the boundary, and the composer editor tests failed with it. Move the React bindings in step. The lockfile drops all 23 nested copies. Lexical 0.50 also wraps a block decorator in zero-size decorator boundary anchors (`<img data-lexical-decorator-boundary>`, absolutely positioned at 0x0, meta/lexical#8888), so the two tests that assert the editable root's children now skip them. They contribute no line box, so the composer's layout is unchanged. Co-authored-by: Ensemblr <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Philipp Soldunov <[email protected]> Co-authored-by: Ensemblr <[email protected]>
This branch was successfully deployed
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.
Description
The block cursor was not displayed before a block-level decorator node (e.g.
HorizontalRuleNode) when the preceding sibling was an editable element such as aParagraphNode. The native browser cursor would appear on the decorator's DOM element (e.g. directly on the<hr>), which is visually misleading — the cursor appears below the element rather than at a meaningful insertion point, and typing inserts a new paragraph above the decorator.The root cause was in
$updateDOMBlockCursorElement(LexicalUtils.ts): when the collapsed element-type selection pointed at a child that needs a block cursor, the code required the previous sibling to also need a block cursor (or benull). The sibling check was intended to avoid showing a block cursor when the native cursor could naturally sit at the end of the preceding editable element, but forDecoratorNodeinstances (which arecontenteditable="false"), the native cursor cannot meaningfully sit on them, making the block cursor necessary regardless of the sibling.This PR removes the sibling check so the block cursor is displayed whenever the adjacent child needs one (
$needsBlockCursorBesidereturnstrue), independently of the preceding sibling. The$needsBlockCursorBesidefunction itself is unchanged — the shadow root guard introduced in #8758 (which prevents block cursors between sibling shadow roots inside a shadow root parent) remains intact.Test plan
Before
paragraph("text") → horizontalrule → paragraph("text"), placing the collapsed selection at root offset 1 (before theHorizontalRuleNode) did not render the block cursor (data-lexical-cursor). The native cursor appeared directly on the<hr>element, visually positioned below it, and typing created a new paragraph above the decorator without any visual indication of the insertion point.Enregistrement.de.l.ecran.2026-07-29.a.13.41.30.mov
After
RichTextBlockCursorShadowRoot.test.ts): 3 new tests verify the block cursor DOM element ([data-lexical-cursor]) is rendered before a block decorator when preceded by an editable paragraph, between two block decorators, and as the first child → all passing.HorizontalRule.spec.mjs): New test "Shows block cursor before a horizontal rule preceded by a paragraph" verifies in a real browser that thePlaygroundEditorTheme__blockCursordiv appears in the DOM between the paragraph and the<hr>after navigating with arrow keys.Enregistrement.de.l.ecran.2026-07-29.a.13.40.59.mov