Open the model picker without the keyboard on phones - #504
Merged
Merged
Conversation
The model picker's popover tracked the search input's focus handle, and PopoverState focuses the tracked handle the moment it opens, so on a phone the sheet came up with the software keyboard over the list it means to be tapped. The tracked focus is now attached only off-phone: a desktop window of any width still types into the search as the picker opens, while a mobile build lets the popover keep its own focus, so Escape and Back still close it and a tap on the search field asks for the keyboard. The composer's own focus checks read `!compact && !is_mobile`. Compact is already `is_mobile && narrow`, so the width half was redundant and read as if the window width took part in the keyboard decision. They now check the build alone, and ChatView::focus_composer no longer pre-empts the composer with its own compact check. model_picker_focuses_its_search_only_off_phone opens the picker in a wide desktop window, a narrow desktop window and on a phone: the search is focused in the first two and unfocused on the phone, and Escape closes the picker in all three.
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.
The model picker's popover tracked the search input's focus handle, and
PopoverState focuses the tracked handle the moment it opens, so on a phone
the sheet came up with the software keyboard over the list it means to be
tapped. The tracked focus is now attached only off-phone: a desktop window
of any width still types into the search as the picker opens, while a
mobile build lets the popover keep its own focus, so Escape and Back
still close it and a tap on the search field asks for the keyboard.
The composer's own focus checks read
!compact && !is_mobile. Compact isalready
is_mobile && narrow, so the width half was redundant and read asif the window width took part in the keyboard decision. They now check the
build alone, and ChatView::focus_composer no longer pre-empts the composer
with its own compact check.
model_picker_focuses_its_search_only_off_phone opens the picker in a wide
desktop window, a narrow desktop window and on a phone: the search is
focused in the first two and unfocused on the phone, and Escape closes the
picker in all three.