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

[CP (beta)] [ios17][text_input]fix ios 17.0 keyboard freeze when switching languages #48041

Conversation

hellohuanlin
Copy link
Contributor

CP for #47566

List which issues are fixed by this PR. You must list at least one issue.

flutter/flutter#134716

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

…ges (without relying on text affinity) (flutter#47566)

After close examination of the UIKit's default string tokenizer, when querying the line enclosing the end of doc position **in forward direction**, we should return nil (regardless whether the position is forward or backward affinity). 

This aligns with the [API doc](https://developer.apple.com/documentation/uikit/uitextinputtokenizer/1614464-rangeenclosingposition?language=objc): 

> If the text position is at a text-unit boundary, it is considered enclosed only if the next position in the given direction is entirely enclosed.

Will cherry pick this soon. Otherwise it will be less and less important as users upgrade to iOS 17.1. 

### Why my previous workaround also works? 

It turns out my previous workaround PR flutter#46591 works only because our misuse of text affinity in our text input. Specifically, when adding text affinity support, we only added it to `FlutterTextPosition`, but not `FlutterTextRange`. So when getting the beginning/end position from the range, we assign arbitrary affinities. 

*List which issues are fixed by this PR. You must list at least one issue.*

flutter#46591

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
@hellohuanlin
Copy link
Contributor Author

This needs CP to both the previous stable (flutter/flutter#138439) and the new beta (flutter/flutter#138440)

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM

@Jasguerrero Jasguerrero added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2023
@auto-submit auto-submit bot merged commit f4f0c1d into flutter:flutter-3.16-candidate.0 Nov 16, 2023
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants