flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.19k stars 27.26k forks source link

Error when autofilling fields for logging in with password managers #155781

Open juan-cruz-99 opened 5 days ago

juan-cruz-99 commented 5 days ago

Steps to reproduce

1-Have a form widget with email and password inputs. 2-Ensure that the email input has autofillHints set to: [AutofillHints.username, AutofillHints.email]. 3-Ensure that the password input has autofillHints set to: [AutofillHints.password]. 4-Attempt to use password managers such as 1Password, Bitwarden, etc 5-Notice that the fields are recognized but do not auto-complete. 6-Note that in some cases, the input loses focus.

Expected results

The expected behavior should be that autofilled inputs fields are automatically populated using password managers for Flutter web, especially since several users use password managers.

Actual results

Autofilled inputs are not populated with password handlers for flutter web

Code sample

Code sample ```dart class AutofillTestView extends StatelessWidget { const AutofillTestView({super.key}); @override Widget build(BuildContext context) { final TextEditingController email = TextEditingController(); final TextEditingController password = TextEditingController(); return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Form( child: SizedBox( width: 300, child: Column( children: [ TextFormField( controller: email, keyboardType: TextInputType.text, autofillHints: [AutofillHints.username, AutofillHints.email], decoration: InputDecoration( errorMaxLines: 3, labelText: "Email", ), ), TextFormField( controller: password, autofillHints: [AutofillHints.password], decoration: InputDecoration( errorMaxLines: 3, labelText: "Password", ), ), ], ), )) ], ); } } ```

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

https://github.com/user-attachments/assets/72aabff8-e1f8-4fc8-af17-d846c00d6433

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 24A335 darwin-arm64, locale es-419) • Flutter version 3.24.3 on channel stable at /Users/juancruzambrosino/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (2 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/juancruzambrosino/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 16.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 16A242d • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.74.2) • VS Code at /Users/juancruzambrosino/Downloads/Visual Studio Code.app/Contents • Flutter extension version 3.60.0 [✓] Connected device (4 available) • iPhone de Juan Cruz (mobile) • 00008030-000970A10220202E • ios • iOS 18.0 22A3354 • macOS (desktop) • macos • darwin-arm64 • macOS 15.0 24A335 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0 24A335 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 129.0.6668.71 [✓] Network resources • All expected network resources are available. • No issues found!```
darshankawar commented 5 days ago

Thanks for the report @juan-cruz-99 Since you are facing this on web, check if this resembles / resonates with your case or not.

This statement from that issue see if it is helpful in your case or not: Currently, autofill via password managers in Flutter only work through context menus.