Repository navigation
fix(desktop): select the query when re-opening the Find bar - #4807
Merged
Merged
Conversation
Re-pressing Find (Cmd/Ctrl-F) while the bar was already open only re-focused the input, leaving the caret after the existing term so the next keystroke appended to it. Select the input's contents after focusing so the current term is highlighted and a keystroke types over it. Fixes #3458 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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
Re-pressing Find (Cmd/Ctrl-F) while the find bar was already open just re-focused the input, leaving the caret after the existing search term. The next keystroke appended to the old term instead of replacing it ("accretion").
Root cause
listenFind()callssearch.value?.focus()but neverselect(), so a re-open lands a collapsed caret at the end of the populated input.Fix
Call
search.value?.select()right after focusing, so the current term is highlighted and a keystroke types over it (harmless when the input is empty).Test
packages/desktop/test/e2e/find-reopen-select-3458.spec.ts(real built app): type a query, re-trigger Find, assert the whole term is selected (selectionStart=0,selectionEnd=len) and that typing replaces it. Verified RED→GREEN; existingfind-replace.spec.tsstill passes.Fixes #3458
🤖 Generated with Claude Code