Repository navigation
[lexical] Bug Fix: resolve line deletion endpoints inside inline decorators - #9247
Merged
etrepum merged 1 commit intoSep 27, 2026
Merged
Conversation
…rators ## Description Forward line deletion can remove only one character when the line ends in a text-bearing inline decorator. For example, with `aaaa bbbb [X]` on one line and the caret after `aa`, `DELETE_LINE_COMMAND(false)` leaves the decorator and most of the text behind. Chromium's native `lineboundary` movement can land on the decorator's internal DOM Text node. That text is not a Lexical TextNode, so range resolution fails and `deleteLine` falls back to character deletion. Normalize this measurement endpoint to the inline decorator's wrapper edge before applying the range. This is limited to line deletion and non-isolated inline decorators belonging to the same editor, with text inside the decorator wrapper's light DOM. Existing root/slot clamping remains in place, and measurement keeps the live DOM selection collapsed. No change to the general selection resolver. Found while investigating meta#9234; the separate soft-wrap over-deletion reported there is not fixed by this PR. ## Test plan ### Before On unchanged `02471a8f91fcb787256c6dc66f2e3ccad20e6eee`, with the new test file: ```sh VITEST_BROWSER=chromium,firefox,webkit pnpm test-browser InlineDecoratorLineDeletion.test.ts ``` ```text Test Files 1 failed | 2 passed (3) Tests 8 failed | 64 passed (72) ``` Failures are Chromium forward deletion with direct/nested decorator text, normal/raised alignment, and rich/plain-text extensions. ### After The same command: ```text Test Files 3 passed (3) Tests 72 passed (72) ``` - Full three-engine browser suite: `761 passed | 7 skipped (768)`. After adding the light-DOM containment guard, the focused new/deletion/shadow-selection suites passed `220` tests with `2` skips. - `pnpm test-unit`: `8797 passed | 1 skipped | 2 failed`. Both failures are source-link-label assertions in `typedocExternalLinks.test.ts`; running that file against unchanged upstream source reproduces both failures. - `pnpm run tsc-test`, ESLint and Prettier for changed files, and `git diff --check` passed. - Independent real-browser checks of these cases in shadow-root and iframe editor roots: `72 passed` across the three engines. Validated on macOS arm64 with Node 26.7.0 and the pinned pnpm 11.24.0. Developed and reviewed with Codex assistance.
maximilliangrand
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
September 27, 2026 18:17
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
Sep 27, 2026
Merged
This was referenced Oct 3, 2026
Closed
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
Forward line deletion can remove only one character when the line ends in a text-bearing inline decorator. For example, with
aaaa bbbb [X]on one line and the caret afteraa,DELETE_LINE_COMMAND(false)leaves the decorator and most of the text behind.Chromium's native
lineboundarymovement can land on the decorator's internal DOM Text node. That text is not a Lexical TextNode, so range resolution fails anddeleteLinefalls back to character deletion. Normalize this measurement endpoint to the inline decorator's wrapper edge before applying the range.This is limited to line deletion and non-isolated inline decorators belonging to the same editor, with text inside the decorator wrapper's light DOM. Existing root/slot clamping remains in place, and measurement keeps the live DOM selection collapsed. No change to the general selection resolver.
Found while investigating #9234; the separate soft-wrap over-deletion reported there is not fixed by this PR.
Test plan
Before
On unchanged
02471a8f91fcb787256c6dc66f2e3ccad20e6eee, with the new test file:Failures are Chromium forward deletion with direct/nested decorator text, normal/raised alignment, and rich/plain-text extensions.
After
The same command:
761 passed | 7 skipped (768). After adding the light-DOM containment guard, the focused new/deletion/shadow-selection suites passed220tests with2skips.pnpm test-unit:8797 passed | 1 skipped | 2 failed. Both failures are source-link-label assertions intypedocExternalLinks.test.ts; running that file against unchanged upstream source reproduces both failures.pnpm run tsc-test, ESLint and Prettier for changed files, andgit diff --checkpassed.72 passedacross the three engines.Validated on macOS arm64 with Node 26.7.0 and the pinned pnpm 11.24.0. Developed and reviewed with Codex assistance.