Repository navigation
[lexical][lexical-rich-text] Bug Fix: Stop the page jumping when tapping a decorator on iOS - #9325
Conversation
…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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… 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
left a comment
There was a problem hiding this comment.
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 —
keydownnever 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 throughaddEventListenerwith no options object. - Read-only editors are untouched: the root-event wrapper gates everything except
clickoneditor.isEditable(), soonMouseDownIOSnever runs there (and a non-editable root opens no keyboard anyway). - Nested editors don't double-handle:
stopLexicalPropagationmeans an image caption's own editor claims themousedown, and the caption'scontenteditablematches the selector from the outer editor's side regardless. - SVG targets: using
nodeType === DOM_ELEMENT_TYPE+Element.matchesrather thanisHTMLElementis the right call, sinceSVGElementfails the latter. Good that there's a test for it. IS_IOSon iPadOS:isIOS()catches the desktop-class Macintosh UA viamaxTouchPoints > 1, so the trackpad guard inonMouseDownIOSis live code, not dead.- Shadow DOM:
getParentElementcrosses open roots; the closed-root retargeting caveat is correctly documented and tested. - Tree-shaking: no new module-scope factory calls, and
FOCUSABLE_SELECTORis a plain string literal, so nothing needs a@__PURE__annotation. - Backwards compatibility: the
InputStateaddition is internal and additive; no public signature changes. - Commit hygiene: subject,
## Description,Closes #9112, and## Test planwith real### Before/### Afteroutput 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]>
## 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) ```
## 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) ```
## 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) ```
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
clickwithpointerType'mouse', before theselectionchangefor the caret it just placed. SoonClickskipped its touch branch, the NodeSelection reachedCLICK_COMMAND, rich text cleared it, and the reconciler removed the new caret before the keyboard opened.This change, iOS only:
mousedownof a touch or pen tap that reaches the editor root through decorator DOM, so no keyboard opens. Theclickstill follows, soCLICK_COMMANDhandlers 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/videowith 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 atabindexon its host to keep native focus.inputmode="none"andpreventScroll, 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 owninputmodecomes 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 attouchend, before iOS handles the tap, so the tap focuses it afresh and iOS opens the keyboard with the caret in view.clicklike a touch click inonClick, so the RangeSelection is built from the caret the tap placed.pointerdownlistener, so a decorator that stops its ownpointerdowncan'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.tsagainst main'sLexicalEvents.tsandLexicalEditor.ts: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
npx vitest run --project unit packages/lexical packages/lexical-rich-text packages/lexical-react packages/lexical-playground: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.