This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit 42b4cfd
authored
[ios][autocorrection]disable auto-correction highlight in iOS 17 (#44176)
This PR disables the "auto-correction highlight" feature in iOS 17.
This feature was introduced in flutter/flutter#45354 and #13959 (CC: @LongCatIsLooong who was the original author)
I have created [a new issue](flutter/flutter#131622) to find other approaches to re-enable this feature.
**Note that "auto-correction" itself still works, it's only the "highlight" part is disabled:**
- iOS 16 with highlight:
https://github.com/flutter/engine/assets/41930132/2fe7bbf6-f2db-4212-a020-e420ad8dd5e6
- iOS 17 without highlight:
https://github.com/flutter/engine/assets/41930132/34f34743-6bef-4e93-80d2-d04c92ba59bf
## Why disable this feature?
The original PR uses `UITextInput::firstRectForRange` API for auto-correction, since Apple does not provide any other API when auto-correction should show up, so the original PR used this API as a workaround.
In iOS 17, Apple changed a few `UITextInput` behaviors:
- UIKit does not query `UITextInput::firstRectForRange` for text range of the auto-corrected word any more.
- But instead, it repeatedly queries every single character of the current word (after entering or deleting a character), regardless whether the word should be auto-corrected or not.
I have tried all other `UITextInput` APIs that takes a text range, and none are suitable for auto-correction feature. As a result, I have to disable this feature for iOS 17 for now.
*List which issues are fixed by this PR. You must list at least one issue.*
Fixes flutter/flutter#128406
*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#style1 parent 5dd660c commit 42b4cfd
File tree
2 files changed
+33
-10
lines changed- shell/platform/darwin/ios/framework/Source
2 files changed
+33
-10
lines changedLines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1632 | 1632 | | |
1633 | 1633 | | |
1634 | 1634 | | |
1635 | | - | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
1639 | 1650 | | |
1640 | 1651 | | |
1641 | 1652 | | |
| |||
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
| 316 | + | |
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
325 | 332 | | |
326 | 333 | | |
327 | 334 | | |
| |||
353 | 360 | | |
354 | 361 | | |
355 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
356 | 368 | | |
357 | 369 | | |
358 | 370 | | |
| |||
0 commit comments