Skip to content

Conversation

@LongCatIsLooong
Copy link
Contributor

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue.

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

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Feb 4, 2022
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are a bunch of failures. I think lots of things subtly depend on that requestFocus call.


// This will show the keyboard for all selection changes on the
// EditableWidget, not just changes triggered by user gestures.
requestKeyboard();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reminds me, I recently wrote an unfinished PR where you and I discussed removing this requestKeyboard altogether: #93333 (comment)

I closed the PR without merging because I didn't think it was possible to do yet without further refactoring, so it's probably fine to still do requestKeyboard below in this PR. Just wanted to point out the relation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that PR, removing this line caused a bunch of test failures, maybe similar to the test failures that are happening now for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I feel requestKeyboard is usually just a side-effect of the user interaction (e.g. ) and shouldn't be bundled with _handleSelectionChanged

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the original issue, the other textfield grabs the keyboard focus and the autocomplete failed to fill the passowrd field? can you explain more why a autocomplete cannot fill the unfocus textfield in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry missed the comment. Discussed it offline but for the record this is another case of the race that happens when the platform text input plugin issues 2 consecutive changes. The autofill service first autofills the email field which is not focused by the time and immediately autofills the password field. The change in the email field arrives at the framework first and makes the email field the focus, which in turn triggers an setClient call, erasing the content in the password field in the platform text input plugin.

await tester.pumpAndSettle();

final EditableTextState state2 = tester.state<EditableTextState>(find.byWidget(editableText2));
// Update editableText2, should not request focus.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Maybe say "Update editableText2 as if it were autofilled, should not request focus."

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks fine, but i am curious how does this solve the issue.

@LongCatIsLooong
Copy link
Contributor Author

@chunhtai before the patch when the unfocused username text field gets autofilled it triggers a focus change and resets the current content in the password field (as it calls setClient and what's already in the password field will be erased).

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fluttergithubbot fluttergithubbot merged commit 6656356 into flutter:master Feb 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 11, 2022
@LongCatIsLooong LongCatIsLooong deleted the fix-autofill-focus branch February 11, 2022 17:06
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IOS] Autofill on login form works on e-mail field, but not on password field

4 participants