Skip to content

revert(lexical): remove root-element carveout from #8613 (keep the typing test)#8616

Merged
potatowagon merged 1 commit into
facebook:mainfrom
potatowagon:navi/revert/8613-keep-test
Jun 3, 2026
Merged

revert(lexical): remove root-element carveout from #8613 (keep the typing test)#8616
potatowagon merged 1 commit into
facebook:mainfrom
potatowagon:navi/revert/8613-keep-test

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Summary

Reverts the source changes from #8613 (the dom === rootElement carveout in $getNearestManagedNodePairFromDOMNode and the twin fallback in $getNodeFromDOM). Keeps the black-box empty-editor typing smoke test that #8613 also added.

Why

#8613 hypothesized that #8588's switch from the root-element carveout to the __lexicalKey_* root stash was dropping root-targeted DOM mutations, causing typed text not to register in a downstream app (the symptom that triggered an internal sync auto-revert).

@mayrang and @etrepum were right that this wasn't the cause: under normal mount/typing the root carries the __lexicalKey_* stash, so root resolution already succeeds and the carveout is a no-op. As @etrepum noted, the only way the stash goes missing is if the root element is replaced — and in that case the dom === rootElement identity check is dead too.

The actual regressor was #8519's active-editor-scope tightening surfacing in a downstream $generateHtmlFromNodes caller. That call site opened a headless-clone update scope but passed the original editor to $generateHtmlFromNodes, so the post-#8519 $assumeActiveEditor(editor) check threw (activeEditor was the headless clone, not the passed editor). The throw aborted the update that runs on input, so typed text never committed → the word-count-gated control stayed disabled. Fixed at that call site (pass the active/headless editor); the failing e2e goes green with that fix and stays green with this carveout reverted.

What's kept

LexicalEmptyEditorTyping.test.ts — a black-box "type into a fresh empty editor → text reconciles" smoke test. It's useful coverage and passes independently of the carveout (documented in the file: it does not reproduce the original regression at the jsdom level, which needs a real browser).

Test plan

cc @mayrang @etrepum

…(not the real fix)

facebook#8613 re-added the `dom === rootElement` → RootNode carveout to
`$getNearestManagedNodePairFromDOMNode` and the twin fallback in
`$getNodeFromDOM`, on the theory that facebook#8588's switch to the `__lexicalKey_*`
root stash dropped root-targeted mutations. As @mayrang and @etrepum correctly
predicted, that wasn't the cause: under normal mount/typing the root stash is
always present, so the carveout is a no-op for the reported regression.

The actual regressor was facebook#8519's active-editor-scope tightening surfacing in a
downstream `$generateHtmlFromNodes` caller (a headless-clone serialization path
that passed the original editor instead of the active/headless one →
`$assumeActiveEditor` throw → aborted update → typed text never committed).
Fixed at that call site; verified the failing e2e goes green there.

This reverts the two source changes from facebook#8613 to restore facebook#8588's intended
single-key-lookup design. The black-box empty-editor typing smoke test added in
facebook#8613 is kept — it's useful coverage and passes independently of the carveout.
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Jun 3, 2026 3:23am
lexical-playground Ready Ready Preview, Comment Jun 3, 2026 3:23am

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 Jun 3, 2026
@potatowagon potatowagon added this pull request to the merge queue Jun 3, 2026
Merged via the queue into facebook:main with commit da66f08 Jun 3, 2026
42 of 46 checks passed
@etrepum etrepum mentioned this pull request Jun 25, 2026
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.

2 participants