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

[SuperEditor] Show software keyboard upon tap (Resolves #1816) #1978

Merged
merged 4 commits into from May 20, 2024

Conversation

angelosilvestre
Copy link
Collaborator

[SuperEditor] Show software keyboard upon tap. Resolves #1816

Steps to reproduce:

  1. Place the selection at an arbitrary position
  2. Close the software keyboard using the system button
  3. Tap again on the same selected position

After that, the software keyboard isn't shown.

The reason is that we show the software keyboard when selection changes. Because the selection didn't change, the software keyboard isn't show.

This PR forwards SoftwareKeyboardController to the Android touch interactor so it can show the keyboard upon tap.

I couldn't reproduce this on iOS because I didn't find any system button to close the keyboard. We have an above-the-keyboard panel button to close the keyboard, but in reality we are closing the IME connection when tapping on it. I noticed that Flutter doesn't expose a method to close the software keyboard, so it's probably a good idea to file an issue for that.

Open questions:

  • Should we remove the code that opens the keyboard when selection changes?
  • Should we replicate the same implementation to iOS?

@matthew-carroll
Copy link
Contributor

My initial thought is that if the Android gesture interactor only needs to be able to open the keyboard, then we probably shouldn't pass in a whole controller. In general, any API that you expose to an object will eventually be used by that object, even if not strictly necessary. So we should be careful when passing things around like that.

Is there any reason that we need to pass a whole controller instead of just a callback method?

Should we remove the code that opens the keyboard when selection changes?

I didn't follow the rationale there. Why do we want to remove it?

Should we replicate the same implementation to iOS?

Which implementation? Is there a behavior that's expected on iOS that we currently aren't honoring on iOS?

@angelosilvestre
Copy link
Collaborator Author

@matthew-carroll

Is there any reason that we need to pass a whole controller instead of just a callback method?

No particular reason. We can pass just a callback if needed.

Should we remove the code that opens the keyboard when selection changes?

I didn't follow the rationale there. Why do we want to remove it?

If we will always show the keyboard upon tap, showing the keyboard also when selection changes might be unnecessary.

Should we replicate the same implementation to iOS?

Which implementation? Is there a behavior that's expected on iOS that we currently aren't honoring on iOS?

I mean to show the keyboard upon tap

@matthew-carroll
Copy link
Contributor

No particular reason. We can pass just a callback if needed.

Ok, let's do that.

If we will always show the keyboard upon tap, showing the keyboard also when selection changes might be unnecessary.

Do we have existing policies related to focus change, or programmatic placing of the caret, which would be impacted by that?

I mean to show the keyboard upon tap

Yeah, I suppose we should duplicate that change.

@angelosilvestre
Copy link
Collaborator Author

@matthew-carroll Updated the implementation.

If we will always show the keyboard upon tap, showing the keyboard also when selection changes might be unnecessary.

After checking again I think we shouldn't remove that, since it's configurable via policies.

@@ -1315,6 +1315,41 @@ Paragraph two
});
});

testWidgetsOnMobile('shows software keyboard when tapping at the selected position', (tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change this to "opens software keyboard when tapping on caret"

Also, should there be a test for an expanded selection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Contributor

@matthew-carroll matthew-carroll left a comment

Choose a reason for hiding this comment

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

LGTM

@matthew-carroll matthew-carroll merged commit 2597d97 into main May 20, 2024
11 checks passed
@matthew-carroll matthew-carroll deleted the 1816_show-software-keyboard-on-tap branch May 20, 2024 19:18
quaaantumdev pushed a commit to quaaantumdev/super_editor that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Super Editor] [Android] Unable to open the keyboard once I hide it with the system button.
2 participants