-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[ios17][text_input]fix ios 17.0 keyboard freeze when switching languages (without relying on text affinity) #47566
[ios17][text_input]fix ios 17.0 keyboard freeze when switching languages (without relying on text affinity) #47566
Conversation
I need to do more testing on iOS 17.0 and 17.1 (and the newly released 17.1.1), around voice control, scribble and floating cursor selection. But so far this PR is looking good and should be ready for review |
Is it undocumented? The docs for the method we are implementing say:
Isn't the case here that we are at a boundary, and the next position in the given direction doesn't exist (in which case the next position can't be entirely enclosed)? |
True. It sounds indeed like what we are doing here. |
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.
LGTM with comment nit.
inDirection:(UITextDirection)direction { | ||
// TODO(hellohuanlin): remove iOS 17 check. The same logic should apply to older iOS version. | ||
if (@available(iOS 17.0, *)) { | ||
// If querying the line from end of document in forward direction, report not found. |
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.
This should link to and quote the docs I mentioned in my comment so that it's clear why.
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.
LGTM. Thanks for looking into this!
…ing languages (without relying on text affinity) (flutter/engine#47566)
…ing languages (without relying on text affinity) (flutter/engine#47566)
…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
…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
…ing languages (without relying on text affinity) (flutter/engine#47566)
…138441) flutter/engine@f15b259...c5a067b 2023-11-14 [email protected] Roll Skia from 650913eacd01 to 15a2577b12c1 (1 revision) (flutter/engine#48036) 2023-11-14 [email protected] Roll Skia from 6feae2c274ce to 650913eacd01 (1 revision) (flutter/engine#48034) 2023-11-14 [email protected] [macOS] Eliminate unused OCMock includes (flutter/engine#48031) 2023-11-14 [email protected] [ios17][text_input]fix ios 17.0 keyboard freeze when switching languages (without relying on text affinity) (flutter/engine#47566) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ching languages (#48041) 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].* [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
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:
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 #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 notFlutterTextRange
. 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/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
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.