Code editor search bar (Cmd+F) does not select existing text on re-open, causing typed input to append#7919
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
WalkthroughThe change adds a single line to auto-select the search input text when the CodeMirrorSearch component receives focus via its imperative handle, improving keyboard navigation and user experience during search workflows. ChangesSearch Input Focus Enhancement
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@helloanoop can I get some reviews on this MR? |
I have checked the following:
This bug is:
Bruno version
<your version, e.g. 3.3.0>
Operating System
macOS 26.3.1 (a)
Describe the bug
In the Response pane (and any
CodeEditorsurface — request body, pre/post-request scripts, tests editor) the custom search bar (CodeMirrorSearch) does not select its existing text when re-opened withCmd+F/Ctrl+F.The component preserves
searchTextstate across open/close cycles, and on re-open the input is re-focused but the caret lands at the end of the existing query. Typing new characters then appends to the old query instead of replacing it.This diverges from native browser and IDE search-bar behavior (Chrome's Cmd+F, VS Code, etc., all pre-select the existing query on re-open).
Steps to reproduce
Cmd+F(macOS) /Ctrl+F(Win/Linux).item_1.Escto dismiss the search bar.Cmd+F/Ctrl+Fagain.item_2.Expected: Step 5 selects the existing
item_1so step 6 replaces it. The search input readsitem_2.Actual: Step 5 places the caret at the end of
item_1. Step 6 appends, producingitem_1item_2.Affected surfaces
The bug reproduces in every
CodeEditorinstance, since they all shareCodeMirrorSearch:.bru file to reproduce the bug
Not required — reproducible against any request that returns a body.
Proposed fix
In
packages/bruno-app/src/components/CodeMirrorSearch/index.js, the imperativefocus()exposed viauseImperativeHandleonly callsinputRef.current.focus(). AddinginputRef.current.select()immediately after it makes the existing search term selected on every re-open via the keyboard shortcut.PR: #7919