Skip to content

Focus the Find in Files window when opening the dock - #125845

Open
EuanTop wants to merge 1 commit into
godotengine:masterfrom
EuanTop:fix/find-in-files-window-focus
Open

EuanTop wants to merge 1 commit into
godotengine:masterfrom
EuanTop:fix/find-in-files-window-focus

Conversation

@EuanTop

@EuanTop EuanTop commented Nov 26, 2026

Copy link
Copy Markdown

What problem(s) does this PR solve?

Closes #125832.

When Find in Files opens from a floating Script window, the Find field can have control focus while the floating window still receives keyboard input. After showing the dock, request focus for its containing window if the dock is visible and that window is not already focused. Find in Files and Replace in Files share this entry point.

Validation

On macOS 26.7.3 (Apple M3 Pro, single display, Forward+ / Metal), I reproduced the issue on 4.8 beta 5 (reproduction and screenshots). With a local arm64 editor build from 8f2e46bca plus this patch, I focused the floating Script window and ran both shortcuts:

  • Find in Files (Cmd+Shift+F): typing speed immediately populated the Find field and returned two matches.
  • Replace in Files (Cmd+Shift+R): typing player immediately populated the Find field with Replace enabled and returned two matches.

Find in Files receives speed and shows two matches

Replace in Files receives player and shows two matches

Codex assisted with tracing the focus path, drafting the patch, and automating the macOS reproduction and verification.

@EuanTop
EuanTop requested review from a team as code owners November 26, 2026 13:30
@AThousandShips

Copy link
Copy Markdown
Member

Codex assisted with tracing the focus path, drafting the patch, and automating the macOS reproduction and verification.

Did you write the code yourself? Please see our guidelines

void FindInFiles::open_dock(const String &p_initial_text, bool p_replace) {
FindInFilesSearchPanel *search_control = container->get_search_control();
EditorDockManager::get_singleton()->focus_dock(container);
if (container->is_visible_in_tree() && !container->get_window()->has_focus()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not right, the dock should never have to manually focus its window. focus_dock() already does this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ctrl+Shift+F doesn't properly focus the Find field if the Script window is floating

3 participants