Skip to content

Conversation

@nturgut
Copy link
Contributor

@nturgut nturgut commented Oct 25, 2019

Adding handling of TextInputClient.onConnectionClosed messages handling to Framework

Description

Adding a message to the Flutter Framework for clients to call if a connection is closed.

Information in following situations can be synced with the framework using this method call.

  • if the mobile browser is sent to background by pressing the home button on a mobile device.
  • If the blur event is triggered on an input element in a web browser.
  • the user closed the virtual keyboard indication they stopped editing.

This PR is merged and rolled back before: #35100

Related Issues

#43034

Tests

I added the following tests:

  • Unit tests for editable_text_test.dart
  • Unit tests for text_input.dart

Manually tested with the Flutter Web Engine.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

Announcement: https://groups.google.com/forum/#!topic/flutter-announce/IwG8xGA7Kmo

@nturgut nturgut requested review from goderbauer and mdebbar October 25, 2019 00:34
@fluttergithubbot fluttergithubbot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels Oct 25, 2019
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this!

Could you please double-check that this PR doesn't introduce the same regressions that caused the other PR to be reverted? cc @matthew-carroll

@matthew-carroll
Copy link
Contributor

I think we may have said we were waiting for new test infra to attempt another solution to this due to the nuanced ways a fix might introduce new bugs, but I'll defer to @HansMuller @gspencergoog and @collinjackson on that topic.

@goderbauer
Copy link
Member

@matthew-carroll From the comments on #39523 it sounded like the issue that caused the rollback was how we send this event from Android?

@nturgut nturgut force-pushed the clean_client_framework2 branch from fbc80b9 to b79771a Compare October 26, 2019 03:42
@nturgut nturgut requested review from goderbauer and mdebbar October 28, 2019 16:21
@Piinks Piinks added a: text input Entering text in a text field or keyboard related problems platform-web Web applications specifically labels Oct 29, 2019
@nturgut
Copy link
Contributor Author

nturgut commented Oct 30, 2019

We chat with @matthew-carroll and @gspencergoog, and decided to continue with the framework change for now. Android change will follow when the integration tests for testing the behavior is supported.

@matthew-carroll
Copy link
Contributor

@nturgut the update here based on @xster's comment is that if we prioritize this for the upcoming code freeze then we will probably have to implement the Android fix before we have new testing infra. I think web can continue as discussed, but we may be bringing in the Android side earlier than anticipated.

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

LGTM with some comments about the tests.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

Approach looks good.

Added some comments about documentation. Since the text connection is a delicate dance between framework and engine to keep everything in sync we should document very clearly how things are intended to be used.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

This appears to re-introduce bugs for Android from the linked PR.

We should not land this without a test asserting that text input works as expected on Android with these changes.

@nturgut
Copy link
Contributor Author

nturgut commented Oct 31, 2019

This appears to re-introduce bugs for Android from the linked PR.

We should not land this without a test asserting that text input works as expected on Android with these changes.

We already discussed it with @matthew-carroll @goderbauer @gspencergoog it is safe to land

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

After looking a bit more at this with @nturgut, this can't cause problems for Android (or iOS) becuase those embeddings don't ever call this method at this point.

@dnfield dnfield dismissed their stale review October 31, 2019 17:47

This won't impact Android.

…e tests. Added comments to the interfaces.
@nturgut nturgut requested a review from goderbauer November 1, 2019 16:09
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

This looks fine (modulo the breaking change requirements).

However, there are two similar PRs out now. The other one is #43959. Just to double check: Do the addressed use cases really need two new APIs?

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

///
/// * `TextInputClient.onConnectionClosed`: The text input connection closed
/// on the platform side. For example the application is moved to
/// background or used closed the virtual keyboard. This method informs
Copy link
Member

Choose a reason for hiding this comment

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

used? Oh, maybe "the user closed..."?

/// on the platform side. For example the application is moved to
/// background or used closed the virtual keyboard. This method informs
/// [TextInputClient] to clear connection and finalize editing.
/// `TextInput.clearClient` and `TextInput.hide` is not called after
Copy link
Member

Choose a reason for hiding this comment

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

is not called -> must not be called?

@goderbauer goderbauer added the c: API break Backwards-incompatible API changes label Nov 4, 2019
@goderbauer
Copy link
Member

Please link the breaking change announcement from the PR description.

@nturgut
Copy link
Contributor Author

nturgut commented Nov 4, 2019

Please link the breaking change announcement from the PR description.

Done! Thanks.

@nturgut nturgut merged commit 97cf355 into flutter:master Nov 4, 2019
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
flutter#43466)

* Adding handling of TextInputClient.onConnectionClosed messages handling to Framework

* Adding more test cases for closing connection to editable_text_test

* fixing analyze error.

* Fixing analyze error in the test file

* Fixing comments on the new method

* Adding more closing connection examples.

* Indentation change

* Remove auto-add white space

* Changing the oncloseconnection behaviour to stop editing. Updating the tests

* Addressing PR comments. Added explicit log for method channnels to the tests. Added comments to the interfaces.

* add more documentation
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems c: API break Backwards-incompatible API changes framework flutter/packages/flutter repository. See also f: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants