fix(connections): wait for the switcher popover to become key before focusing its search field#1597
Merged
Merged
Conversation
…focusing its search field
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.
Follow-up to #1596 (issue #1575).
Problem
After #1596, typed text in the connection switcher's search field rendered on top of the "Search connections" placeholder: two text layers overlapping.
Root cause
#1596 claimed first responder synchronously in
viewDidMoveToWindowand forcedmakeKey(). That hook fires when the view is attached to the popover's window, before the popover is on screen. Editing began on a window that was not yet visible, so the search field cell never registered the editing session: it kept drawing its placeholder while the field editor drew the typed text over it.Fix
Drop the forced
makeKey()and the early claim. Transient popovers become key on their own when shown, so the field now waits for the documented signal: if the window is already key (sheets), claim first responder immediately; otherwise claim once onNSWindow.didBecomeKeyNotification. The one-shot observer is removed after firing, when the view leaves the window, and on deinit.Editing now starts only after the popover is on screen and key, which is the normal AppKit sequence, so the placeholder clears as soon as text is entered. The #1596 focus fix still holds: the filter field releases focus when the main window resigns key, and typing lands in the search field.
Tests
swiftlint lint --strictclean.Manual verification
No CHANGELOG entry: this fixes behaviour that is itself still unreleased (folded into the existing #1575 entry).