Repository navigation
fix(editor): Escape or Shift+Up/Down keeps the editor a click opens during its save - #13636
Merged
tiensonqin merged 1 commit intoOct 7, 2026
Conversation
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 6, 2026
…uring its save ## Problem A click on a block sometimes opens no editor: the block flashes into edit mode and is back to plain text at once. It happens when the click comes right after Escape or Shift+Up/Down at the first or last line of a block, before that key's save has finished. ## Cause `escape-editing` and `select-block-up-down` (the Shift+Up/Down exit at a block's edge) save the block first and wait for the save, which goes to the worker. Then they leave editing: `clear-edit!`, or `exit-editing-and-set-selected-blocks!`. A click on another block during the save opens that block's editor (pointerdown -> `set-editing!`); when the save settles, the exit clears the editing state again, now the new block's, and its editor unmounts. In a run of the steps Escape or Shift+Up then a click, the events in order: pointerdown on the clicked block; focusin on its textarea; the previous editor removed; focusout on the clicked block's textarea; that textarea removed. Nothing is being edited afterwards. ## Fix Both exits note the editor they start from, and after the save leave editing only if that editor is still the open one. A click during the save keeps the editor it opened. ## Test `frontend.handler.exit-editing-race-test`, with the save held until the click has opened another editor: - Escape during the save: the clicked block's editor stays open. Fails on master. - Shift+Up at a block's edge during the save: the same. Fails on master. - Without a click, Escape still exits and Shift+Up still selects the block. `frontend.handler.editor-test` passes (110 tests).
tiensonqin
force-pushed
the
fix/deferred-exit-keeps-new-edit
branch
from
October 7, 2026 11:32
7dd21d1 to
c1b7094
Compare
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 8, 2026
devin-ai-integration Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
…uring its save (#13636) ## Problem A click on a block sometimes opens no editor: the block flashes into edit mode and is back to plain text at once. It happens when the click comes right after Escape or Shift+Up/Down at the first or last line of a block, before that key's save has finished. ## Cause `escape-editing` and `select-block-up-down` (the Shift+Up/Down exit at a block's edge) save the block first and wait for the save, which goes to the worker. Then they leave editing: `clear-edit!`, or `exit-editing-and-set-selected-blocks!`. A click on another block during the save opens that block's editor (pointerdown -> `set-editing!`); when the save settles, the exit clears the editing state again, now the new block's, and its editor unmounts. In a run of the steps Escape or Shift+Up then a click, the events in order: pointerdown on the clicked block; focusin on its textarea; the previous editor removed; focusout on the clicked block's textarea; that textarea removed. Nothing is being edited afterwards. ## Fix Both exits note the editor they start from, and after the save leave editing only if that editor is still the open one. A click during the save keeps the editor it opened. ## Test `frontend.handler.exit-editing-race-test`, with the save held until the click has opened another editor: - Escape during the save: the clicked block's editor stays open. Fails on master. - Shift+Up at a block's edge during the save: the same. Fails on master. - Without a click, Escape still exits and Shift+Up still selects the block. `frontend.handler.editor-test` passes (110 tests).
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 11, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 11, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 13, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 13, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 16, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 16, 2026
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.
Problem
A click on a block sometimes opens no editor: the block flashes into edit mode and is back to plain text at once. It happens when the click comes right after Escape or Shift+Up/Down at the first or last line of a block, before that key's save has finished.
Cause
escape-editingandselect-block-up-down(the Shift+Up/Down exit at a block's edge) save the block first and wait for the save, which goes to the worker. Then they leave editing:clear-edit!, orexit-editing-and-set-selected-blocks!. A click on another block during the save opens that block's editor (pointerdown ->set-editing!); when the save settles, the exit clears the editing state again, now the new block's, and its editor unmounts.In a run of the steps Escape or Shift+Up then a click, the events in order: pointerdown on the clicked block; focusin on its textarea; the previous editor removed; focusout on the clicked block's textarea; that textarea removed. Nothing is being edited afterwards.
Fix
Both exits note the editor they start from, and after the save leave editing only if that editor is still the open one. A click during the save keeps the editor it opened.
Test
frontend.handler.exit-editing-race-test, with the save held until the click has opened another editor:frontend.handler.editor-testpasses (110 tests).