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

[iOS] Fix view removal process for AutofillContextAction.cancel #57209

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2675,8 +2675,11 @@ - (void)hideTextInput {
[self removeEnableFlutterTextInputViewAccessibilityTimer];
_activeView.accessibilityEnabled = NO;
[_activeView resignFirstResponder];
[_activeView removeFromSuperview];
[_inputHider removeFromSuperview];
// Removes the focus from the `_activeView` (UIView<UITextInput>)
// when the user stops typing (keyboard is hidden).
// For more details, refer to the discussion at:
// https://github.com/flutter/engine/pull/57209#discussion_r1905942577
[self cleanUpViewHierarchy:YES clearText:YES delayRemoval:NO];
}

- (void)triggerAutofillSave:(BOOL)saveEntries {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,27 @@ - (void)testInitialActiveViewCantAccessTextInputDelegate {
XCTAssertNil(textInputPlugin.activeView.textInputDelegate);
}

- (void)testAutoFillDoesNotTriggerOnHideButTriggersOnCommit {
// Regression test for https://github.com/flutter/flutter/issues/145681.
NSMutableDictionary* configuration = self.mutableTemplateCopy;
[configuration setValue:@{
@"uniqueIdentifier" : @"field1",
@"hints" : @[ UITextContentTypePassword ],
@"editingValue" : @{@"text" : @""}
}
forKey:@"autofill"];
[configuration setValue:@[ [configuration copy] ] forKey:@"fields"];

[self setClientId:123 configuration:configuration];
XCTAssertEqual(self.viewsVisibleToAutofill.count, 1ul);

[self setTextInputHide];
// Before the fix in https://github.com/flutter/engine/pull/57209, it was 0ul.
XCTAssertEqual(self.viewsVisibleToAutofill.count, 1ul);

[self commitAutofillContextAndVerify];
}

#pragma mark - Accessibility - Tests

- (void)testUITextInputAccessibilityNotHiddenWhenShowed {
Expand Down
Loading