refactor(toolbar): use native NSSearchField in the connection and database switchers#1389
Merged
Conversation
a014acc to
27aa58e
Compare
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 #1386 (Active Connections popover).
Why
Both the connection switcher and the database switcher hand-rolled their search field: an
HStackwith a magnifying-glass SF Symbol, a plainTextField, a custom rounded background, and a manual clear button. That mimics a search field but is not the native control, so it misses the realNSSearchFieldbezel, the system clear button, the search-field accessibility role, and native Escape-to-clear.The codebase already has a native wrapper,
NativeSearchField(NSSearchFieldviaNSViewRepresentable, used by the sidebar). Both switchers should use it.Change
Replace the custom search
HStackinConnectionSwitcherPopoverandDatabaseSwitcherPopoverwithNativeSearchField, wiringonMoveUp/onMoveDown/onSubmitto the existing navigation and commit actions. This removes the per-view@FocusState, the manual.onKeyPressarrow/Return/Escape handlers, and the hand-built clear button.NativeSearchFieldalready handles arrow and Return via the field'sdoCommandBy, and on Escape clears the field when it has text and otherwise lets the event through so the popover dismisses.Net
-113lines across the two views.Behavior
Same interaction, now native: type to filter, arrow keys to move, Return to switch, Escape to clear then dismiss, plus the standard search-field clear button. The database switcher keeps its list
primaryActionfor Return when the list itself has focus.No CHANGELOG or docs change: the user-facing behavior is unchanged, this is an internal move to the native control.