-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dismiss bottom sheet on return key submit #20848
Dismiss bottom sheet on return key submit #20848
Conversation
I've been unable to test on Android today (only iOS) – if someone can help with that, that would be appreciated. |
When the user creates or edits a link in text and a bottom sheet is shown, both the bottom sheet and the keyboard must be dismissed when the keyboard return key is tapped.
There are two scenarios in regards to the Button Block because the link button and the settings button open different bottom sheets. The `isLinkSheetVisible` handles the first scenario and `closeGeneralSidebar` handles the second.
15c84cb
to
bfad633
Compare
This is looking good @guarani ! 🎉 I did notice on iOS that when tapping the return key the keyboard would dismiss along with the bottom sheet and then immediately reappear. I don't think this is necessarily a blocker for this PR, but if it's possible to avoid that disappear/reappear it would be nice (could either have the keybaord just disappear and not reappear or could have the keyboard remain open the whole time). FWIW, on Android the keyboard just disappears and does not reappear. What do you think? |
Thanks for testing this @mchowning, I'm having trouble getting the Android emulator to run (and I will get myself an Android phone soon).
Yeah, I noticed that too. The existing behavior on iOS (prior to this PR) is:
I think it makes sense for the keyboard to not reappear, which will bring this in-line with Android. I can look to add the change to this PR since I think it's relevant to the issue. |
In offline discussion, @iamthomasbishop suggested that we in fact keep iOS the way it is, and change Android so that its keyboard reappears when the the bottom sheet is dismissed. The reasoning is that since the block's input was focused before opening the bottom sheet, it should again be focused after closing the sheet. |
I'd like to ask you for another review please @mchowning as the previous comment has now been resolved as per wordpress-mobile/gutenberg-mobile#1164 (comment). Could I also ask you to please test on Android, @mchowning? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me and we can address the (minor) Android issue separately.
Fixes wordpress-mobile/gutenberg-mobile#1164
Description
Bottom sheets may contain text inputs. When a text input has focus and the keyboard is displayed, tapping the Return button on the keyboard should dismiss the bottom sheet.
How has this been tested?
There are two types of bottom sheets:
(The sheet that the Latest Posts block uses does not include text inputs which use the return key on their keyboard, so its not affected by this change.)
The link sheet appears in any block that includes a rich text area such as Paragraph, Heading, Button, Image (caption), Video (caption), Cover, List, Gallery, Media & Text, etc.
The Button block settings sheet is present only on the Button block.
Paragraph Block
Button Block
Screenshots
Types of changes
Checklist: