Repository navigation
[lexical-react][lexical-playground] Bug Fix: restore focus after dragging decorator blocks - #9064
Merged
Merged
Conversation
…ging decorator blocks ## Description Restore the editor's DOM focus when a draggable block operation ends without replacing an existing node selection. Marking the selection dirty keeps the DOM selection synchronized while preserving decorator selection. Closes meta#9048 ## Test plan ### Before The new E2E regression failed in Chromium and WebKit because the contenteditable root remained unfocused after dragging a selected YouTube decorator block. ### After The regression passes in Chromium and WebKit. The complete DraggableBlock E2E file passes in Chromium (5 tests). Prettier and ESLint pass for the changed files. Firefox is excluded because the existing draggable-block E2E coverage skips it for platform-specific drag behavior.
luantaraschi
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
August 11, 2026 23:13
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Aug 13, 2026
…estoration ## Description Consolidate the repeated focus restoration logic into a shared helper and run the decorator drag regression in Firefox as well as Chromium and WebKit. ## Test plan ### Before The decorator focus regression explicitly skipped Firefox, and focus restoration was repeated in four drag and blur paths. ### After The focused regression passed in Chromium, Firefox, and WebKit: 3 passed (6.8s). Prettier and ESLint passed for both changed files, and git diff --check reported no whitespace errors.
etrepum
approved these changes
Aug 13, 2026
Merged
This branch was successfully deployed
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.
Description
Dragging a selected decorator block can leave focus outside the editor. The selected node still appears active, but keyboard input no longer reaches the contenteditable root.
Firefox can blur the editor before
dragstart, so the plugin restores focus from its Firefox-specific blur and drag handlers. Chromium and WebKit can instead lose focus when the drag ends. This change uses onerestoreEditorFocushelper for both paths and applies the same recovery fromdragend.Closes #9048
Test plan
Before
The new E2E regression failed in Chromium and WebKit because the contenteditable root remained unfocused after dragging a selected YouTube decorator block. The test skipped Firefox.
After
The focused regression passes in Chromium, Firefox, and WebKit:
The complete DraggableBlock file passes all five Chromium tests. In the cross-browser run, the new regression also passed in Firefox and WebKit. Two older WebKit drag-placement cases still fail locally without touching the new focus assertion.
Prettier and ESLint pass for both changed files.