Skip to content

[lexical][lexical-playground] Bug Fix: keep root text right after repeated slot edits, and read the DOM caret on keydown - #9283

Merged
etrepum merged 6 commits into
meta:mainfrom
rinarakaki:fix/root-text-cache-after-slot-edit
Oct 2, 2026
Merged

etrepum merged 6 commits into
meta:mainfrom
rinarakaki:fix/root-text-cache-after-slot-edit

Conversation

@rinarakaki

@rinarakaki rinarakaki commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Root text after repeated slot edits. A decorator slot host's text includes its slots' text. An edit inside a slot marks the host dirty through __slotHost but doesn't clone it, so the text size the reconciler caches on the host instance (CACHED_TEXT_SIZE_KEY) is never rewritten, and is stale after the first slot edit. When the host is in the dirty suffix of a parent with four or more children, the children fast path splices the parent's cached text by the suffix's previous size, which $prevSuffixTextSize read from that cache, so it cut too little. From the second edit on, $getRoot().getTextContent() and text-content listeners got part of the old slot text: ab\ncd CCDE where the tree reads ab\ncd CDE.

$prevSuffixTextSize now measures a leaf that hosts slots with getTextContentSize(), inside the walk's existing read of the previous state, and $setCachedTextSize no longer caches a size on slot hosts, so no stale value is left on them. Both fast paths go through it: the same-size suffix splice and $tryReconcileSuffixWithSizeDelta. A host that gains or loses slots does so through getWritable(), so the new version starts uncached and is measured or cached correctly. The cost is measuring a slot host's slot text, only when it is in a spliced suffix.

Keydowns acting on a stale caret. On keydown, $internalCreateRangeSelection reuses the last Lexical selection instead of reading the DOM. Chromium coalesces selectionchange events, so when keys arrive faster than the main thread handles them (key repeat, a busy page, a loaded CI runner), a caret move the browser made natively can still be unreported when the next keydown runs. That keydown then acts on the caret from before the move. An ArrowRight in RTL text next to a decorator decides there is still text to cross and lets the browser jump over the decorator, and a Backspace deletes at the old position. This is what made "Move right from DecoratorNode in RTL #7771" fail and "Can backspace across a link" flake on macOS Chromium. Keydowns for the keys whose handlers move the caret or edit at it (arrows, Backspace, Delete, Enter, Tab) now resolve the selection from the DOM, with the same within-editor guard selectionchange uses.

WebKit e2e expectation. setRootElement sets user-select: text on every editor root. The image caption copy and paste test expected WebKit to leave it out of the serialized style. The WebKit that ships with Playwright 1.63 (#9311) serializes it like Chromium and Firefox, so the test now expects it on every browser.

Closes #9277

Test plan

Before

New unit tests in LexicalSlot.test.ts, "named-slots: root text after repeated slot edits", check $getRoot().getTextContent() after every edit: a decorator host that ends a paragraph of four children, one that is the last of four blocks, and a text appended or removed after an edited host (the size-delta path, +1 and -1). Two controls pass before and after: three children, where the fast path doesn't engage, and an inline element host, which is sized from its DOM cache.

$ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical/src/__tests__/unit/LexicalSlot.test.ts -t "root text after repeated slot edits"
 × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of four children
 × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a block decorator host that is the last of four blocks
 × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text appended after an edited decorator host
 × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text removed after an edited decorator host
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of three children
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline element host that ends a paragraph of four children
AssertionError: expected 'ab\ncd CCDE' to be 'ab\ncd CDE' // Object.is equality
AssertionError: expected 'a\n\nb\n\nc\n\nCCDE' to be 'a\n\nb\n\nc\n\nCDE' // Object.is equality
AssertionError: expected 'ab\ncd CCD ef' to be 'ab\ncd CD ef' // Object.is equality
AssertionError: expected 'ab\ncd CCD' to be 'ab\ncd CD' // Object.is equality
      Tests  4 failed | 2 passed | 118 skipped (124)

The keydown race reproduces on main in Linux Chromium (Chrome for Testing 153.0.8010.12, the build Playwright 1.63 uses) by throttling the CPU 20x around the key presses of the two e2e tests. Logging Lexical's selection against the DOM's at each keydown shows the DOM caret moving while Lexical's stays put:

keydown: lexical=5@3/RangeSelection dom=#text@3
selectionchange
keydown: lexical=5@2/RangeSelection dom=#text@2
keydown: lexical=5@2/RangeSelection dom=#text@1
keydown: lexical=5@2/RangeSelection dom=#text@0
keydown: lexical=5@2/RangeSelection dom=#text@3
selectionchange

RTL caret after five ArrowRight presses (expected offset 3), and paragraph text after the link test's four Backspaces (expected abf), 3 of 3 runs each:

rate 20: #text:קצת @2
links rate 20:  def

After

 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of four children
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a block decorator host that is the last of four blocks
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text appended after an edited decorator host
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text removed after an edited decorator host
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of three children
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline element host that ends a paragraph of four children
      Tests  6 passed | 118 skipped (124)
rate 20: #text:קצת @3
links rate 20:  abf

A differential fuzz of the reconciler's root text (300 seeds of 40 random edits over text, line breaks, inline and block decorator hosts, element hosts and nested hosts, compared against a fresh tree walk after each update) failed 237 of 300 seeds before the reconciler change and passes all 300 after it. The keydown change wasn't exercised on macOS, Firefox or WebKit outside CI, and the WebKit user-select expectation can only be checked by CI.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 30, 2026
@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexical Ready Ready Preview Oct 2, 2026 3:42pm UTC
lexical-playground Ready Ready Preview Oct 2, 2026 3:42pm UTC

Request Review

…in a decorator's named slot

## Description

A decorator slot host's text includes its slots' text. An edit inside a slot marks the host dirty through `__slotHost` but doesn't clone it, so the text size the reconciler caches on the host instance (`CACHED_TEXT_SIZE_KEY`) is never rewritten, and is stale after the first slot edit. When the host is in the dirty suffix of a parent with four or more children, the children fast path splices the parent's cached text by the suffix's previous size, which `$prevSuffixTextSize` reads from that cache, so it cuts too little. From the second edit on, `$getRoot().getTextContent()` and text-content listeners get part of the old slot text: `ab\ncd CCDE` where the tree reads `ab\ncd CDE`.

`$prevSuffixTextSize` now measures a leaf that hosts slots with `getTextContentSize()`, inside the walk's existing read of the previous state, instead of reading its cached size. Both fast paths go through it: the same-size suffix splice and `$tryReconcileSuffixWithSizeDelta`. The comments that said every leaf's cached size is valid now name the exception. The cost is measuring a slot host's slot text, only when it is in a spliced suffix.

meta#9260 changes the same cache for elements that override `getTextContent`; it doesn't touch this path.

Closes meta#9277

## Test plan

New unit tests in `LexicalSlot.test.ts`, "named-slots: root text after repeated slot edits", check `$getRoot().getTextContent()` after every edit: a decorator host that ends a paragraph of four children, one that is the last of four blocks, and a text appended or removed after an edited host (the size-delta path, +1 and -1). Two controls pass before and after: three children, where the fast path doesn't engage, and an inline element host, which is sized from its DOM cache.

### Before

```
$ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical/src/__tests__/unit/LexicalSlot.test.ts -t "root text after repeated slot edits"
 × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of four children
 × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a block decorator host that is the last of four blocks
 × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text appended after an edited decorator host
 × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text removed after an edited decorator host
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of three children
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline element host that ends a paragraph of four children
AssertionError: expected 'ab\ncd CCDE' to be 'ab\ncd CDE' // Object.is equality
AssertionError: expected 'a\n\nb\n\nc\n\nCCDE' to be 'a\n\nb\n\nc\n\nCDE' // Object.is equality
AssertionError: expected 'ab\ncd CCD ef' to be 'ab\ncd CD ef' // Object.is equality
AssertionError: expected 'ab\ncd CCD' to be 'ab\ncd CD' // Object.is equality
 Test Files  1 failed (1)
      Tests  4 failed | 2 passed | 118 skipped (124)
```

### After

```
$ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical/src/__tests__/unit/LexicalSlot.test.ts -t "root text after repeated slot edits"
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of four children
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a block decorator host that is the last of four blocks
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text appended after an edited decorator host
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text removed after an edited decorator host
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of three children
 ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline element host that ends a paragraph of four children
 Test Files  1 passed (1)
      Tests  6 passed | 118 skipped (124)
```

The full unit run (`pnpm run test-unit`) passes except for three tests:

```
 FAIL  |unit| packages/lexical/src/__tests__/unit/FastPathCrossParent.test.ts > fast path differential fuzz — cross-parent moves > fast path matches the general walk across cross-parent moves
 FAIL  |unit| packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts > link destination whitespace does not backtrack > reads a run of tabs
 FAIL  |scripts-unit| scripts/__tests__/unit/typedocExternalLinks.test.ts > links external types and sources with a pnpm install
 Test Files  3 failed | 366 passed (369)
      Tests  3 failed | 9014 passed | 1 skipped (9018)
```

The first two timed out at 5 s under load, and pass when run alone (`FastPathCrossParent.test.ts` and `LexicalMarkdown.test.ts`: 591 passed). `typedocExternalLinks.test.ts` failed only because that run passed a relative `TMPDIR`; with an absolute one it passes (2 passed). `pnpm run tsc`, `pnpm run tsc-test`, prettier and eslint pass on the changed files. No public API changes, so Flow isn't affected; no browser tests were needed, since the change is in the reconciler's text cache.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
claude added 2 commits October 2, 2026 05:21
…ditor in WebKit too

## Description

`setRootElement` sets `style.userSelect = 'text'` on every editor root. The
"Copy + paste HTML of a figure with img and figcaption" e2e test expected
WebKit to leave `user-select: text` out of the caption editor's serialized
style. The WebKit that ships with Playwright 1.63 (bumped on main in meta#9311)
serializes it like Chromium and Firefox, so the WebKit run now fails. The
test now expects `user-select: text` on every browser.

## Test plan

### Before

WebKit e2e on macOS CI:

```
[webkit] › packages/lexical-playground/__tests__/e2e/CopyAndPaste/html/ImageHTMLCopyAndPaste.spec.mjs:31:3 › HTML Image CopyAndPaste › Copy + paste HTML of a figure with img and figcaption
Error: innerHTML of contenteditable in page did not match
-         style="white-space: pre-wrap; word-break: break-word"
+         style="user-select: text; white-space: pre-wrap; word-break: break-word"
```

### After

Not run: WebKit isn't available in the environment this was written in, so
the WebKit e2e run needs CI. Chromium and Firefox already expected
`user-select: text`, so their expectation is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…dles itself

## Description

On keydown, `$internalCreateRangeSelection` reuses the last Lexical selection
and only reads the DOM for selectionchange, beforeinput, composition, drop
and triple-click events. Chromium coalesces selectionchange events, so when
keys arrive faster than the main thread processes them (key repeat, a busy
page, a loaded CI runner) a caret move the browser made natively can still be
unreported when the next keydown runs. That keydown then acts on the caret
from before the move: an ArrowRight in RTL text next to a decorator decides
there is still text to cross and lets the browser jump over the decorator,
and a Backspace deletes at the old position.

Keydowns for the keys whose handlers move the caret or edit at it (arrows,
Backspace, Delete, Enter, Tab) now resolve the selection from the DOM, with
the same within-editor guard selectionchange uses.

## Test plan

Reproduced with the Chrome for Testing build Playwright 1.63 uses
(153.0.8010.12) by throttling the CPU 20x around the key presses of the
"Move right from DecoratorNode in RTL meta#7771" and "Can backspace across a
link" e2e tests, and logging Lexical's selection against the DOM's at each
keydown.

### Before

```
keydown: lexical=5@3/RangeSelection dom=#text@3
selectionchange
keydown: lexical=5@2/RangeSelection dom=#text@2
keydown: lexical=5@2/RangeSelection dom=#text@1
keydown: lexical=5@2/RangeSelection dom=#text@0
keydown: lexical=5@2/RangeSelection dom=#text@3
selectionchange
```

RTL caret after five ArrowRight presses (expected offset 3), and paragraph
text after the link test's four Backspaces (expected " abf "):

```
rate 20: #text:קצת @2   (3 of 3 runs)
links rate 20:  def     (3 of 3 runs)
```

### After

```
rate 20: #text:קצת @3   (3 of 3 runs)
links rate 20:  abf     (3 of 3 runs)
```

`pnpm run test-unit`: 355 files, 5797 passed. Not exercised: macOS (where CI
failed), Firefox and WebKit.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@etrepum etrepum changed the title [lexical] Bug Fix: keep root text content right after repeated edits in a decorator's named slot [lexical][lexical-playground] Bug Fix: keep root text right after repeated slot edits, and read the DOM caret on keydown Oct 2, 2026
@etrepum
etrepum added this pull request to the merge queue Oct 2, 2026
Merged via the queue into meta:main with commit 5679d32 Oct 2, 2026
46 checks passed
@rinarakaki
rinarakaki deleted the fix/root-text-cache-after-slot-edit branch October 8, 2026 17:30
etrepum pushed a commit to etrepum/lexical that referenced this pull request Oct 11, 2026
…hat acts at it

## Description

A keydown handler that acts at the caret has to see the caret where the browser has it. The browser reports a selection change in a later task, and Chromium also coalesces those reports. So after a native caret move on a busy main thread, the editor's selection can still be the old one when the next keydown arrives. meta#9283 made the editor read the DOM selection on keydown for arrow keys, Backspace, Delete, Enter and Tab, but not for the other shortcuts it handles.

On macOS, Control+H after a run of ArrowLeft deleted the character the caret had already moved past. This is the CI failure in `Selection.spec.mjs` "Can't delete backward a Table", which expected `after` and received `fter`. The same race applies to Control+D/K/O, the format shortcuts (Control or Meta+B/I/U), Space, Home and End, and to a paste, cut or copy that follows a Control or Meta keydown.

The editor now also reads the DOM selection on keydown for Space, Home and End, and for any keydown with Control or Meta held. When the DOM selection is outside the editor (a nested editor, or an input inside a decorator), it keeps its own selection, as it already did for the other keys. A pending format toggled at a collapsed caret (Meta+B, then Meta+I) still combines, because the format is only refreshed when the anchor moves to a different node.

## Test plan

`packages/lexical/src/__tests__/browser/KeyDownDOMSelection.test.ts` moves the DOM selection and dispatches a keydown before the browser reports the move. The e2e test was run with macOS keyboard behavior (macOS user agent, `navigator.platform`, and Playwright's Meta key mapping) at 20x CPU slowdown via `Emulation.setCPUThrottlingRate`: `playwright test Selection.spec.mjs -g "delete backward a Table" --repeat-each=12 --retries=0`.

### Before

```
 FAIL  |browser (chromium)| KeyDownDOMSelection.test.ts > a { key: ' ' } keydown sees a caret move not yet reported
 FAIL  ... > a { key: 'End' } keydown sees a caret move not yet reported
 FAIL  ... > a { key: 'Home' } keydown sees a caret move not yet reported
 FAIL  ... > a { ctrlKey: true, key: 'h' } keydown sees a caret move not yet reported
 FAIL  ... > a { key: 'k', metaKey: true } keydown sees a caret move not yet reported
 FAIL  ... > a { key: 'z', ctrlKey: true } keydown sees a caret move not yet reported
 FAIL  ... > a format shortcut formats the selection the browser has
AssertionError: expected [ [ +0, 1 ] ] to deeply equal [ [ 2, 2 ] ]
AssertionError: expected [ [ 'a', true ], [ 'bc', false ] ] to deeply equal [ [ 'a', false ], [ 'bc', true ] ]
      Tests  7 failed | 1 passed (8)
```

```
    Error: innerHTML of contenteditable in page did not match
    -   <span data-lexical-text="true">after</span>
    +   <span data-lexical-text="true">fter</span>
  7 failed
  5 passed (2.1m)
```

(5 of the 7 failures are the `fter` above; the other 2 timed out loading the page under the slowdown.)

### After

```
$ VITEST_BROWSER=chromium,firefox,webkit vitest run --project browser KeyDownDOMSelection.test.ts
 Test Files  3 passed (3)
      Tests  24 passed (24)
```

```
[12/12] [chromium] › Selection.spec.mjs:960:5 › Selection › Can't delete backward a Table
  12 passed (1.7m)
```

The full unit and browser suites pass (see the previous commit). Real macOS could not be exercised here.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -7
3:### Breaking changes
28:### Features
36:### Fixes
98:### Performance
102:### Other
106:### Contributors
110:### All changes
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

Four fixes change observable output or behavior, so their changesets have
a `Verify:` paragraph and are listed under Behavior changes: #9303 (new
tabs get no `window.opener`), #9272 (imported code content is normalized),
#9261 (`$patchStyleText` styles the selection it is given), #9319 (editor
keys and namespaces are a counter without a DOM).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -8
3:### Breaking changes
28:### Behavior changes
54:### Features
62:### Fixes
108:### Performance
112:### Other
116:### Contributors
120:### All changes
$ sed -n '/^### Behavior changes/,+7p' CHANGELOG.md
### Behavior changes

- **@lexical/link**: Open new-tab links from `ClickableLinkPlugin` / `registerClickableLink` without `window.opener` ([#9303](#9303))

  This prevents the opened page from navigating the editor's tab (reverse tabnabbing). Same-tab opens are unchanged.

  Verify: pages opened from editor links that relied on `window.opener`.

$ node scripts/changesets/range.mjs --from 0.52.0 --breaking --json   # (kind, [(pr, behavior)])
[('breaking', [(9316, False)]), ('behavior', [(9303, True), (9272, True), (9261, True), (9319, True)])]
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

Four fixes change observable output or behavior, so their changesets have
a `Verify:` paragraph and are listed under Behavior changes: #9303 (new
tabs get no `window.opener`), #9272 (imported code content is normalized),
#9261 (`$patchStyleText` styles the selection it is given), #9319 (editor
keys and namespaces are a counter without a DOM).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -8
3:### Breaking changes
28:### Behavior changes
54:### Features
62:### Fixes
108:### Performance
112:### Other
116:### Contributors
120:### All changes
$ sed -n '/^### Behavior changes/,+7p' CHANGELOG.md
### Behavior changes

- **@lexical/link**: Open new-tab links from `ClickableLinkPlugin` / `registerClickableLink` without `window.opener` ([#9303](#9303))

  This prevents the opened page from navigating the editor's tab (reverse tabnabbing). Same-tab opens are unchanged.

  Verify: pages opened from editor links that relied on `window.opener`.

$ node scripts/changesets/range.mjs --from 0.52.0 --breaking --json   # (kind, [(pr, behavior)])
[('breaking', [(9316, False)]), ('behavior', [(9303, True), (9272, True), (9261, True), (9319, True)])]
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
@zurfyx zurfyx mentioned this pull request Oct 27, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — 246fb9ef Deployed Oct 2, 2026 by vercel[bot]
Preview – lexical-playground — 246fb9ef Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: [lexical] After a second edit in a decorator's named slot, the root's cached text repeats the old slot text

3 participants