fix(superdoc): restore find input focus after match navigation (SD-3045)#3240
Open
tupizz wants to merge 1 commit into
Open
fix(superdoc): restore find input focus after match navigation (SD-3045)#3240tupizz wants to merge 1 commit into
tupizz wants to merge 1 commit into
Conversation
The Search extension's goToSearchResult calls editor.view.focus() so the new selection is visible. When the user pressed Enter in the built-in find input, the synchronous focus steal blurred the input β subsequent Enter keystrokes were swallowed by the ProseMirror editor, splitting paragraphs at the match position, invalidating the search session, and resetting the active match index. The user had to click back into the input between every navigation. Re-focus the find input synchronously after goNext / goPrev so repeated Enter / Shift+Enter keeps advancing through matches and the editor never receives the keystroke.
Codecov Reportβ All modified and coverable lines are covered by tests. π’ Thoughts on this report? Let us know! |
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
Pressing Enter in the built-in find/replace input used to advance to the next match once, then drop focus into the ProseMirror editor. Subsequent Enter keystrokes were swallowed by the editor (splitting paragraphs at the match position, invalidating the search session, and resetting the active match index back to zero), forcing the user to click back into the input between every navigation. The "alternating jump back to page 1" symptom in the ticket title is a downstream effect of the same focus steal.
Root cause: the Search extension's
goToSearchResultcallseditor.view.focus()so its newly-set selection is visible β by design when called programmatically β butFindReplaceSurface.vue's Enter handler did not restore focus afterwards.Fix: re-focus the find input synchronously after
goNext/goPrevreturns. The handler already callse.preventDefault(), so once focus stays on the input the editor never sees the keystroke.The change is local to
FindReplaceSurface.vueβ the underlying Search command behaviour (used by the dev sidebar and the publicSuperDoc.goToSearchResultAPI) is unchanged.Test plan
FindReplaceSurface.test.jscovers: Enter keeps focus whengoNextsynchronously steals focus elsewhere; Shift+Enter /goPrevdoes the same; Enter's default is still prevented.