Skip to content
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

[RNMobile] Ensure keyboard opens after requesting focus on Android #57543

Merged
merged 3 commits into from
Jan 4, 2024

Conversation

fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Jan 4, 2024

What?

Ensure the keyboard always opens after the focus is requested in an Aztec view.

Why?

This issue was spotted while running the E2E tests that will be introduced in #57460. As far as we tested, seems to be only reproducible in the Android emulator. However, we decided to implement the fix to make the keyboard show logic more reliable.

How?

The function showSoftKeyboard has been updated with the following conditions:

  1. If the Aztec view is already focused, then open the keyboard.
  2. Otherwise, listen for focus changes, and when it gets focused open the keyboard.

ℹ️ This approach has been based on this article.

Testing Instructions

  1. Build the demo app and run it on an emulator.
  2. Remove all blocks.
  3. Select the first and default paragraph.
  4. Observe that the keyboard opens.
  5. Tap on ➕ button to open the block inserter modal.
  6. Dismiss the modal.
  7. Observe that the paragraph is focused and the keyboard opens.
  8. Add an Image block and select it.
  9. Tap on ➕ button to open the block inserter modal.
  10. Insert a Paragraph block.
  11. Observe that the new paragraph is focused and the keyboard opens.
  12. Remove the paragraph by pressing backspace.
  13. Observe that the Image block gets selected and the keyboard closes.

Testing Instructions for Keyboard

N/A

Screenshots or screencast

N/A

@fluiddot fluiddot added [Type] Bug An existing feature does not function as intended Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) labels Jan 4, 2024
@fluiddot fluiddot requested a review from geriux January 4, 2024 12:14
Copy link
Member

@geriux geriux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice work on finding the culprit and applying a solution 🚀

@fluiddot fluiddot merged commit adbf970 into trunk Jan 4, 2024
59 checks passed
@fluiddot fluiddot deleted the rnmobile/fix/android-open-keyboard-after-focus branch January 4, 2024 14:02
@github-actions github-actions bot added this to the Gutenberg 17.5 milestone Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants