Skip to content

[lexical-list] Bug Fix: Keep a caret after an inline decorator when removing a list - #9300

Merged
etrepum merged 1 commit into
meta:mainfrom
rinarakaki:fix/remove-list-keeps-caret-after-decorator
Sep 30, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
rinarakaki:fix/remove-list-keeps-caret-after-decorator

Conversation

@rinarakaki

Copy link
Copy Markdown
Contributor

Description

$removeList, which REMOVE_LIST_COMMAND runs, moves every point on a list item itself to the start of the new paragraph, whatever its offset. A caret after an inline decorator that ends an item is such a point: in ab ◆ it is (listitem, 2). End on that line puts the caret there, and so do ArrowLeft from the start of the next block and inserting the decorator with $insertNodes. After the list is removed, the caret is at the start of the paragraph, so typing q gives qab ◆ instead of ab ◆q. A caret between the text and the decorator, (listitem, 1), goes to the start too. A selection with an end on the item covers different content afterwards, so typing over it deletes text that wasn't selected. With a selection from after one item's decorator to after the next item's, typing deletes the first item's content and keeps the second's.

The re-anchoring sets the point to $getChildCaret(paragraph, 'next'), the paragraph's start, and never reads the offset. It was written for an empty nested item (#2640, fixed in #2672), where the start is the only place.

With this change, a point on the item moves to the same offset in the paragraph, through $getChildCaretAtIndex(paragraph, offset, 'next'):

  • The paragraph takes the item's children in the same order, so (listitem, n) and (paragraph, n) are the same place. Moving the children doesn't adjust the selection, so the offset is still the item's when it's read.
  • ListItemNode.replace(node, true) maps these points the same way, and $setBlocksType relies on it. So the playground's toolbar, which turns a list off with $setBlocksType, already keeps the caret.
  • At offset 0, $getChildCaretAtIndex returns the caret $getChildCaret did, so empty items, flat or nested, behave as before. Points in the item's children don't change: they move with the children.

The comment above the re-anchoring named only the empty nested item. It now says which points are on the item and why their offset carries over.

Closes #9292

Test plan

RemoveListKeepsSelection.test.ts, next to RemoveListKeepsItemState.test.ts, puts a selection in a bullet list whose items hold some text and then an inline TestDecoratorNode. It calls $removeList() in a second update and compares the anchor and focus with where they should be. In the output, node is the node's text, or its type for an element. Five cases are the reported shapes: a caret after the decorator at the end of the item, a caret between the text and the decorator, a forward and a backward selection with one end after the decorator, and a selection from after one item's decorator to after the next's. Two pin what doesn't change: a caret in the text, and a caret in an empty nested item, the case the re-anchoring was written for.

Before

Trimmed: each test's |unit| <file> > <describe> > prefix and one-line error summary, and each failure report down to its diff.

$ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical-list/src/__tests__/unit/RemoveListKeepsSelection.test.ts
 × a caret after an inline decorator at the end of the item 13ms
 × a caret between the text and an inline decorator 2ms
 × a forward selection with its focus after an inline decorator 2ms
 × a backward selection with its anchor after an inline decorator 1ms
 × a selection from one item to the next 1ms
 ✓ a caret in the text 1ms
 ✓ a caret in an empty nested item 1ms
 FAIL  a caret after an inline decorator at the end of the item
- Expected
+ Received
  [
    {
-     "key": "6",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "3",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
    {
-     "key": "6",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "3",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
  ]
 FAIL  a caret between the text and an inline decorator
- Expected
+ Received
  [
    {
      "key": "9",
      "node": "ab ",
-     "offset": 3,
+     "offset": 0,
      "type": "text",
    },
    {
      "key": "9",
      "node": "ab ",
-     "offset": 3,
+     "offset": 0,
      "type": "text",
    },
  ]
 FAIL  a forward selection with its focus after an inline decorator
- Expected
+ Received
@@ -4,11 +4,11 @@
      "node": "ab ",
      "offset": 1,
      "type": "text",
    },
    {
-     "key": "18",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "15",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
  ]
 FAIL  a backward selection with its anchor after an inline decorator
- Expected
+ Received
@@ -1,11 +1,11 @@
  [
    {
-     "key": "24",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "21",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
    {
      "key": "21",
      "node": "ab ",
      "offset": 1,
 FAIL  a selection from one item to the next
- Expected
+ Received
  [
    {
-     "key": "33",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "27",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
    {
-     "key": "34",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "30",
+     "node": "xy ",
+     "offset": 0,
+     "type": "text",
    },
  ]
 Test Files  1 failed (1)
      Tests  5 failed | 2 passed (7)

After

$ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical-list/src/__tests__/unit/RemoveListKeepsSelection.test.ts
 ✓ a caret after an inline decorator at the end of the item 8ms
 ✓ a caret between the text and an inline decorator 1ms
 ✓ a forward selection with its focus after an inline decorator 1ms
 ✓ a backward selection with its anchor after an inline decorator 1ms
 ✓ a selection from one item to the next 1ms
 ✓ a caret in the text 1ms
 ✓ a caret in an empty nested item 1ms
 Test Files  1 passed (1)
      Tests  7 passed (7)

$ pnpm exec vitest --project unit --no-watch packages/lexical-list packages/lexical/src/__tests__/unit/LexicalListPlugin.test.tsx
 Test Files  17 passed (17)
      Tests  157 passed (157)

$ pnpm run test-unit
 Test Files  370 passed (370)
      Tests  9018 passed | 1 skipped (9019)

pnpm run tsc and pnpm run tsc-test pass, and prettier and eslint are clean on the changed files. There are no public API or type changes, so no Flow changes.

The new tests run in jsdom. No browser or e2e suite reaches $removeList: nothing in the playground dispatches REMOVE_LIST_COMMAND, and its toolbar turns a list off with $setBlocksType. So none was run.

🤖 Generated with Claude Code

…emoving a list

## Description

`$removeList`, which `REMOVE_LIST_COMMAND` runs, moves every point on a list item itself to the start of the new paragraph, whatever its offset. A caret after an inline decorator that ends an item is such a point: in `ab ◆` it is `(listitem, 2)`. End on that line puts the caret there, and so do ArrowLeft from the start of the next block and inserting the decorator with `$insertNodes`. After the list is removed, the caret is at the start of the paragraph, so typing `q` gives `qab ◆` instead of `ab ◆q`. A caret between the text and the decorator, `(listitem, 1)`, goes to the start too. A selection with an end on the item covers different content afterwards, so typing over it deletes text that wasn't selected. With a selection from after one item's decorator to after the next item's, typing deletes the first item's content and keeps the second's.

The re-anchoring sets the point to `$getChildCaret(paragraph, 'next')`, the paragraph's start, and never reads the offset. It was written for an empty nested item (meta#2640, fixed in meta#2672), where the start is the only place.

With this change, a point on the item moves to the same offset in the paragraph, through `$getChildCaretAtIndex(paragraph, offset, 'next')`:
- The paragraph takes the item's children in the same order, so `(listitem, n)` and `(paragraph, n)` are the same place. Moving the children doesn't adjust the selection, so the offset is still the item's when it's read.
- `ListItemNode.replace(node, true)` maps these points the same way, and `$setBlocksType` relies on it. So the playground's toolbar, which turns a list off with `$setBlocksType`, already keeps the caret.
- At offset 0, `$getChildCaretAtIndex` returns the caret `$getChildCaret` did, so empty items, flat or nested, behave as before. Points in the item's children don't change: they move with the children.

The comment above the re-anchoring named only the empty nested item. It now says which points are on the item and why their offset carries over.

Closes meta#9292

## Test plan

`RemoveListKeepsSelection.test.ts`, next to `RemoveListKeepsItemState.test.ts`, puts a selection in a bullet list whose items hold some text and then an inline `TestDecoratorNode`. It calls `$removeList()` in a second update and compares the anchor and focus with where they should be. In the output, `node` is the node's text, or its type for an element. Five cases are the reported shapes: a caret after the decorator at the end of the item, a caret between the text and the decorator, a forward and a backward selection with one end after the decorator, and a selection from after one item's decorator to after the next's. Two pin what doesn't change: a caret in the text, and a caret in an empty nested item, the case the re-anchoring was written for.

### Before

Trimmed: each test's `|unit| <file> > <describe> >` prefix and one-line error summary, and each failure report down to its diff.

```
$ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical-list/src/__tests__/unit/RemoveListKeepsSelection.test.ts
 × a caret after an inline decorator at the end of the item 13ms
 × a caret between the text and an inline decorator 2ms
 × a forward selection with its focus after an inline decorator 2ms
 × a backward selection with its anchor after an inline decorator 1ms
 × a selection from one item to the next 1ms
 ✓ a caret in the text 1ms
 ✓ a caret in an empty nested item 1ms
 FAIL  a caret after an inline decorator at the end of the item
- Expected
+ Received
  [
    {
-     "key": "6",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "3",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
    {
-     "key": "6",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "3",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
  ]
 FAIL  a caret between the text and an inline decorator
- Expected
+ Received
  [
    {
      "key": "9",
      "node": "ab ",
-     "offset": 3,
+     "offset": 0,
      "type": "text",
    },
    {
      "key": "9",
      "node": "ab ",
-     "offset": 3,
+     "offset": 0,
      "type": "text",
    },
  ]
 FAIL  a forward selection with its focus after an inline decorator
- Expected
+ Received
@@ -4,11 +4,11 @@
      "node": "ab ",
      "offset": 1,
      "type": "text",
    },
    {
-     "key": "18",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "15",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
  ]
 FAIL  a backward selection with its anchor after an inline decorator
- Expected
+ Received
@@ -1,11 +1,11 @@
  [
    {
-     "key": "24",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "21",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
    {
      "key": "21",
      "node": "ab ",
      "offset": 1,
 FAIL  a selection from one item to the next
- Expected
+ Received
  [
    {
-     "key": "33",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "27",
+     "node": "ab ",
+     "offset": 0,
+     "type": "text",
    },
    {
-     "key": "34",
-     "node": "paragraph",
-     "offset": 2,
-     "type": "element",
+     "key": "30",
+     "node": "xy ",
+     "offset": 0,
+     "type": "text",
    },
  ]
 Test Files  1 failed (1)
      Tests  5 failed | 2 passed (7)
```

### After

```
$ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical-list/src/__tests__/unit/RemoveListKeepsSelection.test.ts
 ✓ a caret after an inline decorator at the end of the item 8ms
 ✓ a caret between the text and an inline decorator 1ms
 ✓ a forward selection with its focus after an inline decorator 1ms
 ✓ a backward selection with its anchor after an inline decorator 1ms
 ✓ a selection from one item to the next 1ms
 ✓ a caret in the text 1ms
 ✓ a caret in an empty nested item 1ms
 Test Files  1 passed (1)
      Tests  7 passed (7)

$ pnpm exec vitest --project unit --no-watch packages/lexical-list packages/lexical/src/__tests__/unit/LexicalListPlugin.test.tsx
 Test Files  17 passed (17)
      Tests  157 passed (157)

$ pnpm run test-unit
 Test Files  370 passed (370)
      Tests  9018 passed | 1 skipped (9019)
```

`pnpm run tsc` and `pnpm run tsc-test` pass, and prettier and eslint are clean on the changed files. There are no public API or type changes, so no Flow changes.

The new tests run in jsdom. No browser or e2e suite reaches `$removeList`: nothing in the playground dispatches `REMOVE_LIST_COMMAND`, and its toolbar turns a list off with `$setBlocksType`. So none was run.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@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 Sep 30, 2026 4:17pm UTC
lexical-playground Ready Ready Preview Sep 30, 2026 4:17pm UTC

Request Review

@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
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Sep 30, 2026
@etrepum
etrepum added this pull request to the merge queue Sep 30, 2026
Merged via the queue into meta:main with commit b8adcee Sep 30, 2026
50 checks passed
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 — 21756563 Deployed Sep 30, 2026 by vercel[bot]
Preview – lexical-playground — 21756563 Deployed Sep 30, 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-list] Removing a list moves a caret after an inline decorator to the start of the paragraph

2 participants