Skip to content

Fix web autofill not picking up values after Windows Hello authentication - #184673

Closed
rich22222 wants to merge 1 commit into
flutter:masterfrom
describe-me:claude/amazing-golick
Closed

Fix web autofill not picking up values after Windows Hello authentication#184673
rich22222 wants to merge 1 commit into
flutter:masterfrom
describe-me:claude/amazing-golick

Conversation

@rich22222

Copy link
Copy Markdown

Summary

  • Listen for the change DOM event in addition to input on autofill form elements in EngineAutofillForm.addInputEventListeners()
  • When Chrome's password manager is protected by Windows Hello, the async biometric prompt causes credential fills that fire change rather than input, so Flutter never received the updated values
  • Added regression test verifying autofill works via the change event

Fixes #162066

Test plan

  • Added multiTextField Autofill responds to change event test in text_editing_test.dart
  • Manual test: Flutter web app with AutofillGroup + Chrome Windows Hello password protection

Pre-launch Checklist

Generated with Claude Code

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Apr 6, 2026
@google-cla

google-cla Bot commented Apr 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@rich22222
rich22222 force-pushed the claude/amazing-golick branch from 9759788 to eb113e9 Compare April 6, 2026 17:06

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a 'change' event listener to the autofill form to handle asynchronous credential fills, such as those from Windows Hello, and includes a corresponding regression test. Feedback suggests modifying the event handler to process 'change' events even when the element is focused and recommends reusing the event listener instance to improve efficiency.

Comment on lines +443 to +451
void onAutofillEvent(DomEvent e) {
if (items[key] == null) {
throw StateError('AutofillInfo must have a valid uniqueIdentifier.');
} else if (key != focusedElementId) {
// `input` events on the focused element are handled elsewhere.
final AutofillInfo autofillInfo = items[key]!.autofillInfo;
_handleChange(element, autofillInfo);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The current implementation skips the event if the element is focused (key == focusedElementId). While input events on the focused element are typically handled by the main text editing strategy, the PR description notes that Windows Hello authentication may fire change instead of input. If the main strategy does not listen for change events, the focused element will miss the update. Consider allowing change events to be processed here even for the focused element to ensure the fix covers all fields in the autofill group.

Suggested change
void onAutofillEvent(DomEvent e) {
if (items[key] == null) {
throw StateError('AutofillInfo must have a valid uniqueIdentifier.');
} else if (key != focusedElementId) {
// `input` events on the focused element are handled elsewhere.
final AutofillInfo autofillInfo = items[key]!.autofillInfo;
_handleChange(element, autofillInfo);
}
}
void onAutofillEvent(DomEvent e) {
if (items[key] == null) {
throw StateError('AutofillInfo must have a valid uniqueIdentifier.');
} else if (e.type == 'change' || key != focusedElementId) {
// `input` events on the focused element are handled elsewhere.
// We also handle `change` events here to catch async fills that
// might not fire `input` (e.g. Windows Hello).
final AutofillInfo autofillInfo = items[key]!.autofillInfo;
_handleChange(element, autofillInfo);
}
}

Comment on lines 453 to 461
subscriptions.add(
DomSubscription(element, 'input', createDomEventListener(onAutofillEvent)),
);
// The 'change' event is more reliably fired after async credential
// fills (e.g., after Windows Hello authentication in Chrome).
// See https://github.com/flutter/flutter/issues/162066
subscriptions.add(
DomSubscription(
element,
'input',
createDomEventListener((DomEvent e) {
if (items[key] == null) {
throw StateError('AutofillInfo must have a valid uniqueIdentifier.');
} else if (key != focusedElementId) {
// `input` events on the focused element are handled elsewhere.
final AutofillInfo autofillInfo = items[key]!.autofillInfo;
_handleChange(element, autofillInfo);
}
}),
),
DomSubscription(element, 'change', createDomEventListener(onAutofillEvent)),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

You can avoid redundant calls to createDomEventListener by creating the listener once and reusing it for both subscriptions. This improves efficiency and readability.

Suggested change
subscriptions.add(
DomSubscription(element, 'input', createDomEventListener(onAutofillEvent)),
);
// The 'change' event is more reliably fired after async credential
// fills (e.g., after Windows Hello authentication in Chrome).
// See https://github.com/flutter/flutter/issues/162066
subscriptions.add(
DomSubscription(
element,
'input',
createDomEventListener((DomEvent e) {
if (items[key] == null) {
throw StateError('AutofillInfo must have a valid uniqueIdentifier.');
} else if (key != focusedElementId) {
// `input` events on the focused element are handled elsewhere.
final AutofillInfo autofillInfo = items[key]!.autofillInfo;
_handleChange(element, autofillInfo);
}
}),
),
DomSubscription(element, 'change', createDomEventListener(onAutofillEvent)),
);
final DomEventListener listener = createDomEventListener(onAutofillEvent);
subscriptions.add(DomSubscription(element, 'input', listener));
// The 'change' event is more reliably fired after async credential
// fills (e.g., after Windows Hello authentication in Chrome).
// See https://github.com/flutter/flutter/issues/162066
subscriptions.add(DomSubscription(element, 'change', listener));
References
  1. Optimize for readability: Code is read more often than it is written. (link)

…tion

Listen for the 'change' DOM event in addition to 'input' on autofill
form elements. When Chrome's password manager is protected by Windows
Hello, the async biometric prompt causes credential fills that fire
'change' rather than 'input', so Flutter never received the updated
values.

The 'change' event is also handled for the focused element, since the
main text editing strategy only listens for 'input' and would miss
async credential fills on the active field.

Fixes flutter#162066
@mdebbar

mdebbar commented May 5, 2026

Copy link
Copy Markdown
Contributor

I have a feeling the cause may be similar to what we fixed on iOS 26: #182024

On iOS, there's a similar autofill authentication popup, and it caused the input to lose focus temporarily and later gain focus, and Flutter didn't know how to handle that. Would you mind checking if the focused input is receiving a blur event at any point during the Windows Hello authentication?

The fix I made in that PR was limited to iOS, but you may want to expand it to other platforms and see if that helps. Here's the relevant piece of code:

if (ui_web.browser.operatingSystem == ui_web.OperatingSystem.iOs) {

@flutter-zl flutter-zl added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label May 13, 2026
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

This pull request is being closed because it has not been updated in the last 21 days after a request for more information.

If you are still working on this, please feel free to reopen it or file a new pull request.

Thanks for your contribution.

@github-actions github-actions Bot closed this Jun 3, 2026
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 engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ Web ] Flutter web Autofill doesn't work when browser password manager is protected with Windows Hello

5 participants