[web] Fix grouped autofill on iOS Chrome#187459
Conversation
ba013ff to
2f7a634
Compare
2f7a634 to
dd78fad
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces tracking of the last sent autofill text to preserve dormant autofill values when a form is restored, along with a corresponding test. The review feedback identifies a potential regression where programmatic updates from the framework to non-focused fields could be ignored or reverted, and suggests tracking the last processed framework text to distinguish between programmatic updates and browser autofill events.
3162f92 to
b65c116
Compare
|
The symptoms sound very similar to this issue: #177248 When the hidden input's value is updated, does it receive focus first or does it get updated without a focus event? |
|
This case is supposed to be handled by: |
Yes, that path should handle non-focused The difference here is timing: in this repro, the password appears to be written after Then when the dormant form is reused, |
|
autosubmit label was removed for flutter/flutter/187459, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
Fixes #185327
Problem
On iOS Chrome, Chrome Password Manager did put the saved password into Flutter Web's hidden browser input. But Flutter Web still thought the password field was empty, so when it refreshed the autofill form, it copied that old empty value back into the browser input. The password was erased before it showed up in the visible Flutter
TextField.Fix
Before copying Flutter's stored value into a non-focused autofill field, Flutter Web now checks what is already in the browser input. If the browser input already has a password that Flutter has not seen yet, Flutter Web sends that password to the framework and leaves the browser input alone instead of clearing it.
To avoid mistaking a deliberate app change for an autofill, it tracks the last framework value for each field, carried
over when the autofill form is reused. A value the app changed programmatically is still pushed into the DOM; only an
unchanged framework value sitting next to a changed DOM value is treated as a browser autofill.
Demo
iOS Chrome: