Fix search field not visibly taking focus when the search window opens#6
Open
MiMoHo wants to merge 1 commit into
Open
Fix search field not visibly taking focus when the search window opens#6MiMoHo wants to merge 1 commit into
MiMoHo wants to merge 1 commit into
Conversation
The search window is opened from a global hotkey while another app is active. App activation is asynchronous on modern macOS, so the makeFirstResponder: call in showSearchWindow ran before the window could become key: typing reached the field, but no caret appeared and the field looked unfocused. Focus the field from windowDidBecomeKey: instead, once the window has actually taken key status. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Opening the search window (Shift-Cmd-B) did not visibly focus the search field: no blinking caret, the field looked inactive — even though keystrokes actually reached it and text appeared once you typed.
Cause & fix
The window is opened from a global hotkey while another app is active. App activation is asynchronous on modern macOS, so the
makeFirstResponder:call insideshowSearchWindowruns before the window can actually become key, and the field editor/caret is never installed. The fix focuses the field fromwindowDidBecomeKey:(AppController is already the window's delegate), i.e. at the moment the window has genuinely taken key status. The guard onnotification.object == searchWindowkeeps the bezel's behavior unchanged.Testing
clang -fsyntax-onlyclean versus master. No full localxcodebuildavailable on this machine — to verify: focus any other app, hit Shift-Cmd-B, and the caret should now blink in the search field immediately.🤖 Generated with Claude Code