Fix site icon selection keyboard issue #23181
Closed
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.
Fixes #21520
The solution I used here is to dismiss the picker (which closes the keyboard) before opening the Resize & Crop screen. I guess many users who change their site icons have run into this bug because they often have lots of images, and the Photos search (which triggers the keyboard) is very useful for finding the image they're looking for.
The Resize & Crop screen is presented over the
PHPickerViewController
. This is an uncommon way of doing things because thePHPickerViewController
is left open after the user selects their media. In other parts of the app where the picker is used, it's dismissed immediately after selection (e.g. uploading to site media, image block, profile photo picker, etc).Presumably, leaving the picker open saves users time if they want to choose a new image on the Resize & Crop screen. By leaving the picker open, users can move back and forth between the picker and the Resize & Crop screen with little friction.
All the known ways of closing the keyboard don't work with the
PHPickerViewController
's keyboard, as noted in https://stackoverflow.com/questions/76738328/dismiss-keyboard-for-phpickerviewcontroller-not-working.With this PR, this is how choosing a site icon works now (see the video at #21520 (comment) for how it worked before):
RPReplay_Final1715283502.MP4
To test
Regression Notes
The could inadvertently introduce regressions in the the site icon selection flow
Manual testing
Since this flow involves the photo picker, I don't think tests are suitable.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Testing checklist (left unchecked the ones that seem irrelevant for this PR):