[lexical] Bug Fix: refresh pending format and style when removeText moves the caret to another node - #8954
Closed
LeSingh1 wants to merge 1 commit into
Closed
Conversation
…oves the caret to another node
LeSingh1
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
August 7, 2026 10:41
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Backspacing away an empty paragraph merges the caret into the end of the previous block, but
RangeSelection.removeText()only moved the anchor and focus. The pendingformat/stylestill described the paragraph that was just deleted, so the next keystroke was inserted with the wrong formatting and split off into its own text node.removeText()now re-derivesformatandstylefrom the anchor when the caret ends up in a different node than it started in —getFormat/getStylefor a TextNode,getTextFormat/getTextStylefor an ElementNode. This is the same rule$internalCreateRangeSelectionapplies when a selection change resolves to a new anchor. When the caret stays put the pending format is left alone, so a format chosen for the next keystroke still survives an ordinary backspace.insertTextalready snapshots and restores these values around its ownremoveText()call, so that path is unchanged.Adds a unit test covering the reported case and a control for the same-node case.
Fixes #6781