revert(lexical): remove root-element carveout from #8613 (keep the typing test)#8616
Merged
Merged
Conversation
…(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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
Jun 3, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reverts the source changes from #8613 (the
dom === rootElementcarveout in$getNearestManagedNodePairFromDOMNodeand 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 thedom === rootElementidentity check is dead too.The actual regressor was #8519's active-editor-scope tightening surfacing in a downstream
$generateHtmlFromNodescaller. That call site opened a headless-clone update scope but passed the original editor to$generateHtmlFromNodes, so the post-#8519$assumeActiveEditor(editor)check threw (activeEditorwas 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
LexicalEmptyEditorTyping.test.tsand core mutation/reconciler unit tests pass with the carveout removed.cc @mayrang @etrepum