diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index 29a5930cae018..09bd5bc92cb6a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -2380,21 +2380,10 @@ - (void)setSelectionRects:(NSArray*)encodedRects { : NSWritingDirectionRightToLeft]]; } - BOOL shouldNotifyTextChange = NO; - if (@available(iOS 17, *)) { - // Force UIKit to query the selectionRects again on iOS 17+ - // This is to fix a bug on iOS 17+ where UIKit queries the outdated selectionRects after - // entering a character, resulting in auto-correction highlight region missing the last - // character. - shouldNotifyTextChange = YES; - } - if (shouldNotifyTextChange) { - [_activeView.inputDelegate textWillChange:_activeView]; - } + // TODO(hellohuanlin): Investigate why notifying the text input system about text changes (via + // textWillChange and textDidChange APIs) causes a bug where we cannot enter text with IME + // keyboards. Issue: https://github.com/flutter/flutter/issues/133908 _activeView.selectionRects = rectsAsRect; - if (shouldNotifyTextChange) { - [_activeView.inputDelegate textDidChange:_activeView]; - } } - (void)startLiveTextInput { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm index ba4b250d24edf..337284d431a8f 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm @@ -436,38 +436,6 @@ - (void)testInputHiderOverlapWithTextWhenScribbleIsDisabledAfterIOS17AndDoesNotO } } -- (void)testSetSelectionRectsNotifiesTextChangeAfterIOS17AndDoesNotNotifyBeforeIOS17 { - FlutterTextInputPlugin* myInputPlugin = - [[FlutterTextInputPlugin alloc] initWithDelegate:OCMClassMock([FlutterEngine class])]; - - FlutterMethodCall* setClientCall = - [FlutterMethodCall methodCallWithMethodName:@"TextInput.setClient" - arguments:@[ @(123), self.mutableTemplateCopy ]]; - [myInputPlugin handleMethodCall:setClientCall - result:^(id _Nullable result){ - }]; - - id mockInputDelegate = OCMProtocolMock(@protocol(UITextInputDelegate)); - myInputPlugin.activeView.inputDelegate = mockInputDelegate; - - NSArray* selectionRect = [NSArray arrayWithObjects:@0, @0, @100, @100, @0, @1, nil]; - NSArray* selectionRects = [NSArray arrayWithObjects:selectionRect, nil]; - FlutterMethodCall* methodCall = - [FlutterMethodCall methodCallWithMethodName:@"Scribble.setSelectionRects" - arguments:selectionRects]; - [myInputPlugin handleMethodCall:methodCall - result:^(id _Nullable result){ - }]; - - if (@available(iOS 17.0, *)) { - OCMVerify([mockInputDelegate textWillChange:myInputPlugin.activeView]); - OCMVerify([mockInputDelegate textDidChange:myInputPlugin.activeView]); - } else { - OCMVerify(never(), [mockInputDelegate textWillChange:myInputPlugin.activeView]); - OCMVerify(never(), [mockInputDelegate textDidChange:myInputPlugin.activeView]); - } -} - - (void)testTextRangeFromPositionMatchesUITextViewBehavior { FlutterTextInputView* inputView = [[FlutterTextInputView alloc] initWithOwner:textInputPlugin]; FlutterTextPosition* fromPosition = [FlutterTextPosition positionWithIndex:2];