[web] Autofill value of the focused field is lost when the form wakes up from dormant state
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start by tracing how Flutter web closes and restores the text input connection when focus is lost, then inspect how the dormant autofill form handles browser input and change events. Use the provided DevTools reproduction to confirm the behavior: after refocusing, the username input should remain the same element and retain its autofilled value, alongside the password.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Steps to reproduce
On Flutter web, a value the browser autofills into the field that was focused when the autofill form went dormant is thrown away when that field is focused again. Values autofilled into the other fields of the group are kept.
This happens with password managers that ask the user to authenticate before filling. The prompt takes focus away from the page, so the engine closes the text input connection and the autofill form goes dormant. The manager then fills the dormant form.
Minimal app:
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: Scaffold(body: LoginForm())));
class LoginForm extends StatelessWidget {
const LoginForm({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: SizedBox(
width: 320,
child: AutofillGroup(
child: Column(
mainAxisSize: MainAxisSize.min,
children: const [
TextField(autofillHints: [AutofillHints.username]),
TextField(autofillHints: [AutofillHints.password], obscureText: true),
],
),
),
),
);
}
}
With a real password manager (seen with , which asks for authentication before filling):
- Click the username field and pick a saved credential.
- The password manager shows its authentication prompt; authenticate.
- Pick the credential again.
- Only the password appears in the app. The username field stays empty.
- Reload the page and pick the credential (no authentication prompt this time). Both fields are filled.
Deterministic repro in the DevTools console, which simulates the same sequence:
- Click the username field.
- Run:
const u = document.getElementById('username');
const p = document.getElementById('current-password');
window.__u = u;
u.blur(); // window focus loss: relatedTarget == null -> connection closed, form goes dormant
const set = (el, v) => {
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set.call(el, v);
el.dispatchEvent(new Event('input', {bubbles: true}));
el.dispatchEvent(new Event('change', {bubbles: true}));
};
set(u, '[email protected]'); // browser autofills the dormant form
set(p, 'secret');
- Click the username field again.
- Run:
({sameUsername: document.getElementById('username') === __u,
username: document.getElementById('username').value,
password: document.getElementById('current-password').value})
Expected results
Both fields show the autofilled values after step 3.
Actual results
The password field shows secret. The username field is empty. The console prints {sameUsername: false, username: "", password: "secret"}: the username holding the autofilled value was replaced by a new, empty element.
Code sample
Code sample
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: Scaffold(body: LoginForm())));
class LoginForm extends StatelessWidget {
const LoginForm({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: SizedBox(
width: 320,
child: AutofillGroup(
child: Column(
mainAxisSize: MainAxisSize.min,
children: const [
TextField(autofillHints: [AutofillHints.username]),
TextField(autofillHints: [AutofillHints.password], obscureText: true),
],
),
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.47.9, on macOS 27.2 26B123 darwin-arm64, locale en-IL) [799ms]
• Flutter version 3.47.9 on channel stable at /Users/iosiffuterman/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c197ca5199 (3 weeks ago), 2026-10-29 10:10:20 -0400
• Engine revision 89c39edfdf
• Dart version 3.13.7
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use,
enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [1,244ms]
• Android SDK at /Users/iosiffuterman/Library/Android/sdk
• Emulator version 37.2.13.0 (build_id 16740729) (CL:N/A)
• Platform android-37, build-tools 36.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 25.0.3+-15898627-b508.16)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 27.1) [2.7s]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 27A9275
• CocoaPods version 1.17.0
[✓] Chrome - develop for the web [6ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Connected device (3 available) [6.7s]
• iPhone Iosif Futerman (mobile) • 00008120-00181D0E0A70201E • ios • iOS 18.6.2 22G100
• macOS (desktop) • macos • darwin-arm64 • macOS 27.2 26B123 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 157.0.8103.79
! Error: Browsing on the local area network for Zalts iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources [599ms]
• All expected network resources are available.
• No issues found!
- Ngôn ngữ chính
- Dart
- Star
- 181k
- Fork
- 32.2k
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 387
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của flutter/flutter
-
BoxShadow.lerp returns the wrong blur style at t = 0 or t = 1Có thể đã có người làm @ArtemChikolaev đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
TestPlatformDispatcher does not forward setSemanticsTreeEnabled to wrapped PlatformDispatcherCó thể đã có người làm @kingdomseed đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
widgetWithIcon and widgetWithImage ignore skipOffstageCó thể đã có người làm @kaluli123123 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của flutter/flutter
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 60/100
hiddify/hiddify-app#2668 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
toyota-connected/emb_cli#358 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: import beta cluster: callers box improvements severity: minor status: confirmed type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ibanner56/CallersCompendium#2366 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ccch1mneyyy/dsh-Go#1777 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: mobile documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
CommandLineCoding/Elephant#383 ·
Maintainer thường phản hồi trong vòng 1 ngày