File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
engine/src/flutter/shell/platform/darwin/ios/framework/Source Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -2685,8 +2685,11 @@ - (void)hideTextInput {
2685
2685
[self removeEnableFlutterTextInputViewAccessibilityTimer ];
2686
2686
_activeView.accessibilityEnabled = NO ;
2687
2687
[_activeView resignFirstResponder ];
2688
- [_activeView removeFromSuperview ];
2689
- [_inputHider removeFromSuperview ];
2688
+ // Removes the focus from the `_activeView` (UIView<UITextInput>)
2689
+ // when the user stops typing (keyboard is hidden).
2690
+ // For more details, refer to the discussion at:
2691
+ // https://github.com/flutter/engine/pull/57209#discussion_r1905942577
2692
+ [self cleanUpViewHierarchy: YES clearText: YES delayRemoval: NO ];
2690
2693
}
2691
2694
2692
2695
- (void )triggerAutofillSave : (BOOL )saveEntries {
Original file line number Diff line number Diff line change @@ -2718,6 +2718,27 @@ - (void)testInitialActiveViewCantAccessTextInputDelegate {
2718
2718
XCTAssertNil (textInputPlugin.activeView .textInputDelegate );
2719
2719
}
2720
2720
2721
+ - (void )testAutoFillDoesNotTriggerOnHideButTriggersOnCommit {
2722
+ // Regression test for https://github.com/flutter/flutter/issues/145681.
2723
+ NSMutableDictionary * configuration = self.mutableTemplateCopy ;
2724
+ [configuration setValue: @{
2725
+ @" uniqueIdentifier" : @" field1" ,
2726
+ @" hints" : @[ UITextContentTypePassword ],
2727
+ @" editingValue" : @{@" text" : @" " }
2728
+ }
2729
+ forKey: @" autofill" ];
2730
+ [configuration setValue: @[ [configuration copy ] ] forKey: @" fields" ];
2731
+
2732
+ [self setClientId: 123 configuration: configuration];
2733
+ XCTAssertEqual (self.viewsVisibleToAutofill .count , 1ul );
2734
+
2735
+ [self setTextInputHide ];
2736
+ // Before the fix in https://github.com/flutter/flutter/pull/160653, it was 0ul.
2737
+ XCTAssertEqual (self.viewsVisibleToAutofill .count , 1ul );
2738
+
2739
+ [self commitAutofillContextAndVerify ];
2740
+ }
2741
+
2721
2742
#pragma mark - Accessibility - Tests
2722
2743
2723
2744
- (void )testUITextInputAccessibilityNotHiddenWhenShowed {
You can’t perform that action at this time.
0 commit comments