Skip to content

fix(ui): focus and select existing review search text - #1152

Merged
backnotprop merged 1 commit into
backnotprop:mainfrom
omederos:fix/reselect-review-search-query
Jul 30, 2026
Merged

fix(ui): focus and select existing review search text#1152
backnotprop merged 1 commit into
backnotprop:mainfrom
omederos:fix/reselect-review-search-query

Conversation

@omederos

@omederos omederos commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Context

A common workflow while reviewing a diff is:

  1. Notice a function, type, or variable that needs more context.
  2. Double click, copy its name.
  3. Press Cmd/Ctrl+F to open the review search.
  4. Paste the name and press Enter.
  5. Inspect its definition and usages, open a result, and continue reviewing.
  6. Repeat the same flow for the next symbol.

The first search works naturally because the search field starts empty. After that, the previous query remains in the
field. When Cmd/Ctrl+F is used again, the caret is at the end of the existing query, instead of selecting the entire text. Pasting another symbol can therefore append it to the previous query instead of replacing it.

See example below:

CleanShot 2026-07-29 at 21 45 52

Expected behavior

Reopening search with Cmd/Ctrl+F should select the existing query so the next typed or pasted symbol replaces it immediately. Browsers, editors, IDEs, etc. do this.

CleanShot 2026-07-29 at 21 49 22

Changes

  • Allow the review search shortcut when focus is already inside the review search input.
  • Continue preserving native Cmd/Ctrl+F behavior in every other input, textarea, and content-editable element.
  • Focus and select the complete existing query whenever review search is opened.
  • Add regression coverage for:
    • handling the shortcut outside editable controls;
    • handling it inside the review search input;
    • selecting the existing query on every search opening.
  • Include the new DOM regression test in CI.

Scope

This does not change search matching, indexing, result navigation, or shortcut availability. Existing guards for views without review search remain unchanged.

Testing

  • TypeScript typecheck suite
  • DOM_TESTS=1 bun test packages/review-editor/hooks/useReviewSearch.test.tsx

@backnotprop
backnotprop merged commit d06f96d into backnotprop:main Jul 30, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants