Skip to content

[lexical][lexical-rich-text] Bug Fix: Stop the page jumping when tapping a decorator on iOS - #9325

Merged
etrepum merged 8 commits into
meta:mainfrom
etrepum:claude/ios-decorator-tap-scroll
Oct 5, 2026
Merged

etrepum merged 8 commits into
meta:mainfrom
etrepum:claude/ios-decorator-tap-scroll

Conversation

@etrepum

@etrepum etrepum commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

On iOS, tapping a decorator such as an image scrolled the page toward the top of the editor. The tap focused the editor (or, when it already had focus, asked for the keyboard again), and iOS answered by opening the keyboard and revealing the caret. A NodeSelection leaves no DOM caret, so iOS revealed the top of the editor instead. Device logs showed no scroll calls from Lexical: the jump came with the keyboard opening (visual viewport height 754 → 404).

Tapping text right after selecting a decorator had the same jump for a related reason. iOS fires the tap's click with pointerType 'mouse', before the selectionchange for the caret it just placed. So onClick skipped its touch branch, the NodeSelection reached CLICK_COMMAND, rich text cleared it, and the reconciler removed the new caret before the keyboard opened.

This change, iOS only:

  • Cancels the mousedown of a touch or pen tap that reaches the editor root through decorator DOM, so no keyboard opens. The click still follows, so CLICK_COMMAND handlers select the node as before. Anything on the way that takes the tap itself keeps its default: form controls (unless disabled), links, summary, iframe, object, embed, audio/video with controls, [tabindex] (including -1), and nested editors. The walk crosses open shadow roots. A closed shadow root hides its controls and the tap is retargeted to its host, so such a widget needs a tabindex on its host to keep native focus.
  • When the editor didn't have focus, focuses it from code with inputmode="none" and preventScroll, so keys from an iPad hardware keyboard (Backspace to delete the image) reach it with no on-screen keyboard and no scroll. The root's own inputmode comes back on the next press that isn't cancelled, on blur, or when the root element changes. A tap on text first blurs the editor at touchend, before iOS handles the tap, so the tap focuses it afresh and iOS opens the keyboard with the caret in view.
  • Treats a tap's click like a touch click in onClick, so the RangeSelection is built from the caret the tap placed.
  • Leaves iPadOS trackpad and mouse presses alone in both places. The pointer type comes from a capture-phase pointerdown listener, so a decorator that stops its own pointerdown can't hide it.

No DOM selection is created for the NodeSelection.

Closes #9112

Test plan

Before

npx vitest run packages/lexical/src/__tests__/unit/IosDecoratorTap.test.ts against main's LexicalEvents.ts and LexicalEditor.ts:

     × cancels the mousedown so no keyboard opens 165ms
     × focuses an unfocused editor without a keyboard or a scroll 14ms
     × leaves an editor that already has focus alone 9ms
     × puts the root's inputmode back on the next tap on text 11ms
     × keeps the quiet focus through a scroll 18ms
     × removes inputmode when the editor loses focus 9ms
     × cancels the mousedown on SVG artwork 11ms
     × looks through an open shadow root 10ms
     × cancels the mousedown on a disabled control 8ms
     × reads the pointer type even when a decorator stops pointerdown 8ms
     × keeps the default for a trackpad or mouse press 8ms
     × keeps the caret the tap placed 10ms
      Tests  12 failed | 8 passed (20)

On an iPhone (iOS 18.7, Safari), a probe build of the playground logged a 498 px jump on tapping the image, and a 488 px jump on tapping text after it.

After

      Tests  20 passed (20)

npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground:

 Test Files  356 passed (356)
      Tests  5783 passed | 1 skipped (5784)

On the same iPhone, with the cancel and click changes in the probe build, the image tap logged a jump of 0 px with no keyboard, and tapping text below the image kept the caret visible above the keyboard. With the quiet focus added to the probe, the image tap still opened no keyboard and didn't move the page, and tapping text afterwards opened the keyboard with the caret above it; in the iOS Simulator with the host keyboard, Backspace after the image tap deleted the image. The review changes (pointer type, shadow roots, selector) are covered by the unit tests only. iPadOS was not exercised.

claude added 2 commits October 4, 2026 16:48
…ing a decorator on iOS

## Description

On iOS, tapping a decorator such as an image scrolled the page toward the top
of the editor. The tap focused the editor (or, when it already had focus,
asked for the keyboard again), and iOS answered by opening the keyboard and
revealing the caret. A NodeSelection leaves no DOM caret, so iOS revealed the
top of the editor instead. Device logs showed no scroll calls from Lexical:
the jump came with the keyboard opening (visual viewport height 754 → 404).

Tapping text right after selecting a decorator had the same jump for a related
reason. iOS fires the tap's `click` with `pointerType` 'mouse', before the
`selectionchange` for the caret it just placed. So `onClick` skipped its touch
branch, the NodeSelection reached `CLICK_COMMAND`, rich text cleared it, and
the reconciler removed the new caret before the keyboard opened.

This change, iOS only:

- Cancels the `mousedown` of a tap on a decorator element, so focus stays where
  it is and no keyboard opens. The `click` still follows, so `CLICK_COMMAND`
  handlers select the node as before. Taps on interactive elements inside the
  decorator (a nested editor such as an image caption, form controls, links,
  `[tabindex]`) keep their default.
- Treats the tap's `click` like a touch click in `onClick`, so the
  RangeSelection is built from the caret the tap placed.

No DOM selection is created for the NodeSelection.

Closes meta#9112

## Test plan

### Before

`npx vitest run packages/lexical-rich-text/src/__tests__/unit/RichTextDecoratorTapIOS.test.ts`,
with the `LexicalEvents.ts` change stashed:

```
     × cancels the mousedown so the editor does not take focus 145ms
     × keeps the caret the tap placed 18ms
      Tests  2 failed | 2 passed (4)
```

On an iPhone (iOS 18.7, Safari), a probe build of the playground logged a
498 px jump on tapping the image, and a 488 px jump on tapping text after it.

### After

```
      Tests  4 passed (4)
```

`npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground packages/lexical-table packages/lexical-list`:

```
 Test Files  355 passed (355)
      Tests  5762 passed | 1 skipped (5763)
```

On the same iPhone, with the same two changes in the probe build, the image
tap logged a jump of 0 px with no keyboard, and tapping text below the image
kept the caret visible above the keyboard. The behavior is gated on `IS_IOS`,
so other platforms are unchanged. iPadOS was not exercised.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
## Description

The iOS decorator tap check walked the DOM itself to find the decorator
element and any interactive element inside it. Decorator DOM is already
marked unmanaged with captured selection, so the check now uses
`isDOMCapturingSelection`, and keeps the tap's default unless the nearest
focusable element is the editor root. The two iOS `events.push` calls are
fused into one.

## Test plan

### After

`npx vitest run packages/lexical-rich-text/src/__tests__/unit/RichTextDecoratorTapIOS.test.ts`:

```
      Tests  4 passed (4)
```

`npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground packages/lexical-table packages/lexical-list`:

```
 Test Files  355 passed (355)
      Tests  5762 passed | 1 skipped (5763)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@vercel

vercel Bot commented Oct 4, 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 5, 2026 4:23pm UTC
lexical-playground Ready Ready Preview Oct 5, 2026 4:23pm 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 Oct 4, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Oct 4, 2026
… presses on decorators alone

## Description

The iOS decorator tap fix cancelled every mousedown on a decorator. On
iPadOS a trackpad or mouse sends real mousedown events, and cancelling them
stops WebKit from starting a drag, while those presses never open the
keyboard that caused the jump. The cancel now applies only when the latest
pointerdown was a touch or pen, tracked in `onPointerDown`.

The focus check is also split out with a comment, so it reads as "cancel
only when the element this tap would focus is the editor root"; a tap inside
a button, input or nested editor in the decorator keeps its default, as
before.

## Test plan

### Before

`npx vitest run packages/lexical-rich-text/src/__tests__/unit/RichTextDecoratorTapIOS.test.ts`:

```
     × keeps the default for a trackpad or mouse press 19ms
      Tests  1 failed | 4 passed (5)
```

### After

```
      Tests  5 passed (5)
```

`npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground`:

```
 Test Files  356 passed (356)
      Tests  5768 passed | 1 skipped (5769)
```

Not exercised on an iPad.

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

## Description

The pointer type that tells an iOS tap from an iPadOS trackpad press was a
module-level variable. It now lives in `editor._inputState.lastPointerType`
with the editor's other per-editor input state.

## Test plan

### After

`npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground`:

```
 Test Files  356 passed (356)
      Tests  5768 passed | 1 skipped (5769)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…for iOS decorator taps

## Description

The iOS decorator tap check used `closest()`, which stops at a shadow
boundary, so an image inside a decorator's open shadow root never reached
the editor root and the tap still focused the editor. It now walks
ancestors with `getParentElement`, which crosses shadow roots, keeping the
exemption for anything focusable on the way (a button, an input, a nested
editor).

A closed shadow root hides its controls, and the tap reaches Lexical
retargeted to the host. Such a widget keeps native focus when its host has a
`tabindex`; this is documented in the comment and tested.

## Test plan

### Before

`npx vitest run packages/lexical-rich-text/src/__tests__/unit/RichTextDecoratorTapIOS.test.ts`:

```
     × looks through an open shadow root 17ms
      Tests  1 failed | 6 passed (7)
```

### After

```
      Tests  8 passed (8)
```

`npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground`:

```
 Test Files  356 passed (356)
      Tests  5771 passed | 1 skipped (5772)
```

Not exercised on an iOS device.

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

@potatowagon potatowagon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice piece of debugging, and the write-up is a model of how to report a platform bug — device-measured viewport numbers (754 → 404), a ruled-out hypothesis ("no scroll calls from Lexical"), and two distinct symptoms traced to one root cause. The two mechanisms described match what I see in the code: onPointerDown skips isSelectionChangeFromMouseDown for touch/pen, so onClick is genuinely the only place the post-NodeSelection caret can be recovered, and the new else if arm only runs when the selection is not a RangeSelection, so the blast radius is narrow.

All 40 checks are green on bbeb45d, mac-rich (webkit) included.

A few things below. The first is a concrete asymmetry; the other two majors are questions about the design rather than defects.

Major

1. The onClick widening is missing the trackpad guard that onMouseDownIOS has.

onMouseDownIOS carefully excludes an iPadOS trackpad or mouse press via editor._inputState.lastPointerType === 'mouse' — that is the entire reason the new InputState field exists. But the onClick arm widens on bare IS_IOS:

} else if (
  event.pointerType === 'touch' ||
  event.pointerType === 'pen' ||
  IS_IOS
) {

IS_IOS is true on iPadOS (isIOS() catches the desktop-class UA through maxTouchPoints > 1), so on an iPad with a trackpad or mouse a genuine mouse click after a NodeSelection now takes the touch branch as well. That path is already owned by isSelectionChangeFromMouseDown → the selectionchange handler, so the same RangeSelection gets built twice, once synchronously here and once asynchronously there.

The field you added already distinguishes the two cases exactly — the tap's pointerdown is 'touch' and only the click is mislabelled 'mouse':

(IS_IOS && editor._inputState.lastPointerType !== 'mouse')

2. isDOMCapturingSelection is broader than "a decorator", and the extra cases are ones that want focus.

The comment and the PR description both frame this as a decorator guard, but the flag it reads is also set by the public (experimental) setDOMUnmanaged(dom, {captureSelection: true}), whose own documentation says the subtree is marked precisely so that

the embedded interaction (custom input, focusable widget, etc.) can keep its native caret.

A widget marked that way is asking to own focus, and on iOS this change now cancels its mousedown unless it happens to match FOCUSABLE_SELECTOR. A custom caret widget built on a plain <div> with no tabindex would stop working on iOS only. Either narrow the check to decorator DOM specifically, or document that a captureSelection subtree needs a tabindex on iOS (the same escape hatch the closed-shadow-root comment already describes).

3. The first tap on a decorator no longer focuses the editor at all — what happens to keyboard deletion?

This is the intended mechanism, not an oversight, but it is worth stating the consequence explicitly. Previously, tapping an image focused the editor; now, if the editor did not already have focus, it stays unfocused while the node shows as selected. updateDOMSelection's rootElement.focus({preventScroll: true}) is on the RangeSelection path, so nothing else restores it. Two consequences:

  • On an iPad with a hardware keyboard, tapping an image with a finger and pressing Backspace no longer deletes it — keydown never reaches the root element. (Trackpad users are unaffected, since their press is excluded.)
  • If focus was in some other field — a toolbar input, a search box — it stays there while the decorator renders as selected, so the next keystroke goes somewhere the user is not looking.

Both are arguably better than a 500 px jump, and the first is narrow. But since the point of selecting an image is usually to delete or replace it, it is worth saying in the PR description which of these you consider acceptable, and ideally leaving a comment in onMouseDownIOS recording the trade-off.

Minor

4. FOCUSABLE_SELECTOR misses iframe, and the playground has iframe decorators.

FigmaNode and YouTubeNode both render an <iframe>. An iframe takes focus when tapped, but matches none of input,textarea,select,button,a[href],label,[tabindex],[contenteditable], so a tap on an embed gets its mousedown cancelled and the embedded content never receives focus. Worth adding, along with summary, audio[controls], video[controls], area[href], object and embed — media and disclosure widgets are the same class of "takes the tap itself".

5. lastPointerType goes stale when a decorator stops pointerdown from propagating.

Both handlers are root-element listeners, so a decorator component that calls event.stopPropagation() in its own onPointerDown — a very common pattern, e.g. image resize handles — hides the pointerdown from the root while the mousedown still bubbles. lastPointerType then holds whatever the previous gesture was, so a finger tap can be skipped (if the last gesture was a trackpad press) or a trackpad press wrongly cancelled (if the last gesture was a tap). Attaching the pointerdown bookkeeping in the capture phase, or recording a timestamp alongside the type and ignoring a stale one, would close this.

6. lastPointerType is never cleared, and string is wider than the domain.

It keeps the last value for the lifetime of the editor. PointerEvent['pointerType'] | '' would document the domain; clearing it on pointerup/pointercancel would make (5) fail safe rather than fail stale. Also worth noting that the field is declared unconditionally on InputState but only ever written under IS_IOS, which the JSDoc says but the type does not.

7. Test placement: this is a packages/lexical change tested from packages/lexical-rich-text.

The repo already has an established home for exactly this — packages/lexical/src/__tests__/unit/ holds IosShiftEnter.test.ts, IosKeyboardSuggestions.test.ts, IosEnterAcceptanceBoundary.test.ts, LexicalIosKoreanIME.test.ts and others, all using the same vi.mock('lexical/src/environment') trick. Only the second describe genuinely needs RichTextExtension; the six mousedown tests exercise LexicalEvents.ts alone and currently reach back into core through lexical/src/environment and lexical/src/__tests__/utils from another package.

8. No test covers the gap in (1).

An iPadOS trackpad click on text after a NodeSelection — pointerdown with pointerType: 'mouse', then the click — would pin the guard down and fail today.

9. Disabled controls match FOCUSABLE_SELECTOR but cannot take focus.

button, input, select and textarea match regardless of their disabled state, so tapping a disabled control inside a decorator keeps the default, focuses the editor, and jumps. Adding :not(:disabled) to those four tightens it.

Nits

10. [tabindex] deliberately matches tabindex="-1" (click-focusable but not tab-focusable), and the closed-shadow-root test depends on that. One clause in the comment above the selector would save the next reader working it out.

11. The mouseDown test helper constructs pointerdown as a MouseEvent and defines pointerType by hand; a half-line saying jsdom has no PointerEvent constructor explains why.

12. getComposedEventTarget(event) is called before the lastPointerType === 'mouse' early-out, so the cheap check could come first. Immaterial at this frequency, but it reads slightly backwards.

Things I checked and found fine

  • The listener is not passive, so preventDefault() takes effect — root element events go through addEventListener with no options object.
  • Read-only editors are untouched: the root-event wrapper gates everything except click on editor.isEditable(), so onMouseDownIOS never runs there (and a non-editable root opens no keyboard anyway).
  • Nested editors don't double-handle: stopLexicalPropagation means an image caption's own editor claims the mousedown, and the caption's contenteditable matches the selector from the outer editor's side regardless.
  • SVG targets: using nodeType === DOM_ELEMENT_TYPE + Element.matches rather than isHTMLElement is the right call, since SVGElement fails the latter. Good that there's a test for it.
  • IS_IOS on iPadOS: isIOS() catches the desktop-class Macintosh UA via maxTouchPoints > 1, so the trackpad guard in onMouseDownIOS is live code, not dead.
  • Shadow DOM: getParentElement crosses open roots; the closed-root retargeting caveat is correctly documented and tested.
  • Tree-shaking: no new module-scope factory calls, and FOCUSABLE_SELECTOR is a plain string literal, so nothing needs a @__PURE__ annotation.
  • Backwards compatibility: the InputState addition is internal and additive; no public signature changes.
  • Commit hygiene: subject, ## Description, Closes #9112, and ## Test plan with real ### Before / ### After output all match .github/pull_request_template.md, and iPadOS is explicitly called out as not exercised, which is what the template asks for.

…heck after review

## Description

Follow-ups from review of the iOS decorator tap fix:

- The `onClick` branch that builds a RangeSelection after a NodeSelection
  now also skips iPadOS trackpad and mouse clicks, which `selectionchange`
  already handles, so it no longer builds the selection twice.
- The mousedown is cancelled only when the tap reaches the editor root
  through decorator DOM, rather than anything `isDOMCapturingSelection`
  matches, so a `setDOMUnmanaged({captureSelection: true})` widget in an
  element node keeps native focus.
- The focusable selector adds `iframe`, `object`, `embed`, `summary`,
  `area[href]` and `audio`/`video` with controls, and skips disabled form
  controls.
- `lastPointerType` is recorded by a capture-phase `pointerdown` listener,
  so a decorator that stops its pointerdown can't leave it stale, and its
  type and docs say it is only written on iOS.
- The trade-off (an unfocused editor stays unfocused after the tap, so iPad
  hardware keys don't reach it) is recorded in a comment.
- The tests move to `packages/lexical/src/__tests__/unit/IosDecoratorTap.test.ts`
  next to the other iOS tests, with a test for each of the above.

## Test plan

### Before

`npx vitest run packages/lexical/src/__tests__/unit/IosDecoratorTap.test.ts`
against the previous `LexicalEvents.ts`:

```
     × keeps the default for embeds and media controls 40ms
     × cancels the mousedown on a disabled control 8ms
     × keeps the default for a captured widget outside a decorator 10ms
     × reads the pointer type even when a decorator stops pointerdown 14ms
     × leaves an iPadOS trackpad click to selectionchange 19ms
      Tests  5 failed | 8 passed (13)
```

### After

```
      Tests  13 passed (13)
```

`npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground`:

```
 Test Files  356 passed (356)
      Tests  5776 passed | 1 skipped (5777)
```

Not exercised on an iOS or iPadOS device.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
## Description

A tap on a decorator on iOS cancelled its mousedown so no keyboard opened, but an editor that didn't have focus stayed unfocused, so Backspace on an iPad hardware keyboard didn't delete the selected image.

Now such a tap also focuses the editor from code with `inputmode="none"` and `preventScroll`, so keys reach it with no keyboard and no scroll. The root's own `inputmode` comes back on the next press that isn't cancelled, on blur, or when the root element changes. A tap on text first blurs the editor at touchend, before iOS handles the tap, so the tap focuses it afresh and iOS opens the keyboard with the caret in view (only removing the attribute opened the keyboard over the caret, and blurring at mousedown was too late for the keyboard to open).

## Test plan

### Before

`npx vitest run packages/lexical/src/__tests__/unit/IosDecoratorTap.test.ts` with the `LexicalEvents.ts` and `LexicalEditor.ts` changes stashed:

```
     × focuses an unfocused editor without a keyboard or a scroll 21ms
     × puts the root's inputmode back on the next tap on text 17ms
     × keeps the quiet focus through a scroll 16ms
     × removes inputmode when the editor loses focus 11ms
     × keeps the default for a trackpad or mouse press 6ms
      Tests  5 failed | 15 passed (20)
```

### After

```
      Tests  20 passed (20)
```

`npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground`:

```
 Test Files  356 passed (356)
      Tests  5783 passed | 1 skipped (5784)
```

The same behavior in the playground probe was checked on an iPhone (iOS 18.7, Safari, no hardware keyboard): the image tap opened no keyboard and didn't move the page, and tapping text afterwards opened the keyboard with the caret above it. In the iOS Simulator with the host keyboard, Backspace after the image tap deleted the image. iPadOS was not exercised.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@etrepum
etrepum added this pull request to the merge queue Oct 5, 2026
Merged via the queue into meta:main with commit 1553d0f Oct 5, 2026
42 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 — 99a2bf7f Deployed Oct 5, 2026 by vercel[bot]
Preview – lexical-playground — 99a2bf7f Deployed Oct 5, 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: Clicking on the image in mobile scrolls up

3 participants