Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autofill Hints iOS: obscureText: true forces AutofillHints.newPassword to act like AutofillHints.password #84445

Open
lukepighetti opened this issue Jun 11, 2021 · 7 comments
Labels
a: text input Entering text in a text field or keyboard related problems customer: flex f: material design flutter/packages/flutter/material repository. found in release: 2.2 Found to occur in 2.2 found in release: 2.3 Found to occur in 2.3 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically team-design Owned by Design Languages team triaged-design Triaged by Design Languages team

Comments

@lukepighetti
Copy link

Steps to Reproduce

  1. Run on iOS device
  2. Focus the password text field
  3. Old passwords will be recommended for autofill
  4. Comment line 69
  5. Repeat steps 1-2
  6. New password will be suggested

MCVE

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(SpikeApp());
}

class SpikeApp extends StatelessWidget {
  const SpikeApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: _HomeScreen(),
    );
  }
}

class _HomeScreen extends StatefulWidget {
  const _HomeScreen({Key? key}) : super(key: key);

  @override
  __HomeScreenState createState() => __HomeScreenState();
}

class __HomeScreenState extends State<_HomeScreen> {
  final emailController = TextEditingController();
  final passwordController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    final spacer = SizedBox(height: 25);

    return Scaffold(
      body: SafeArea(
        child: Padding(
          padding: const EdgeInsets.all(25),
          child: AutofillGroup(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                Text('Create account'),
                spacer,
                TextField(
                  controller: emailController,
                  autofillHints: [
                    AutofillHints.email,
                  ],
                  textInputAction: TextInputAction.next,
                  decoration: InputDecoration(
                    hintText: 'Your email',
                  ),
                ),
                spacer,
                TextField(
                  controller: passwordController,
                  autofillHints: [
                    AutofillHints.newPassword,
                  ],

                  /// If you enable obscureText, the autofill on iOS acts like
                  /// autofillHints is set to [AutofillHints.password] instead of
                  /// [AutofillHints.newPassword]
                  ///
                  /// If obscureText is disabled, it acts as expected.

                  obscureText: true,
                  decoration: InputDecoration(
                    hintText: 'Your password',
                  ),
                ),
                spacer,
                ElevatedButton(
                  child: Text('Save account info'),
                  onPressed: () {
                    TextInput.finishAutofillContext();
                  },
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.57.0)
[✓] Connected device (3 available)

• No issues found!
@TahaTesser TahaTesser added the in triage Presently being triaged by the triage team label Jun 14, 2021
@TahaTesser
Copy link
Member

Hi @lukepighetti
Thanks for filing the issue!
I can reproduce the issue obscureText: true in the TextField with AutofillHints.newPassword`

stable master

Check flutter doctor -v outputs for each channel below

flutter doctor -v
[✓] Flutter (Channel stable, 2.2.2, on macOS 12.0 21A5248p darwin-x64, locale en-GB)
    • Flutter version 2.2.2 at /Users/tahatesser/Code/flutter_stable
    • Framework revision d79295af24 (3 days ago), 2021-06-11 08:56:01 -0700
    • Engine revision 91c9fc8fe0
    • Dart version 2.13.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode-beta.app/Contents/Developer
    • Xcode 13.0, Build version 13A5154h
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.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 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.57.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (3 available)
    • Taha’s iPhone (mobile) • e534bcc711c9a011aa892eb51cdb60f40b3acddb • ios            • iOS 12.5.3
    • macOS (desktop)        • macos                                    • darwin-x64     • macOS 12.0
      21A5248p darwin-x64
    • Chrome (web)           • chrome                                   • web-javascript • Google
      Chrome 91.0.4472.77

• No issues found!
[✓] Flutter (Channel master, 2.3.0-17.0.pre.345, on macOS 12.0 21A5248p darwin-x64, locale en-GB)
    • Flutter version 2.3.0-17.0.pre.345 at /Users/tahatesser/Code/flutter_master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1542ace4f (11 hours ago), 2021-06-13 20:59:02 -0400
    • Engine revision ab2c00c771
    • Dart version 2.14.0 (build 2.14.0-208.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode-beta.app/Contents/Developer
    • Xcode 13.0, Build version 13A5154h
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.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 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.57.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (3 available)
    • Taha’s iPhone (mobile) • e534bcc711c9a011aa892eb51cdb60f40b3acddb • ios            • iOS 12.5.3
    • macOS (desktop)        • macos                                    • darwin-x64     • macOS 12.0
      21A5248p darwin-x64
    • Chrome (web)           • chrome                                   • web-javascript • Google
      Chrome 91.0.4472.77

• No issues found!

✅ : No Issue ❌: Issue reproduced

@TahaTesser TahaTesser added f: material design flutter/packages/flutter/material repository. found in release: 2.2 Found to occur in 2.2 found in release: 2.3 Found to occur in 2.3 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically a: text input Entering text in a text field or keyboard related problems and removed in triage Presently being triaged by the triage team labels Jun 14, 2021
@TahaTesser TahaTesser changed the title Autofill Hints iOS: obscureText forces AutofillHints.newPassword to act like AutofillHints.password Autofill Hints iOS: obscureText: true forces AutofillHints.newPassword to act like AutofillHints.password Jun 15, 2021
@djsjr
Copy link

djsjr commented Feb 21, 2022

Update on this? Hopefully will be resolved along with the other slew of autofillHints issues present in 2.8 and 2.10.

@REKURDennis
Copy link

Any chance this will ever be fixed?

@REKURDennis
Copy link

REKURDennis commented Jan 9, 2023

For some reason it is connected with the autocorrect setting. If you set it to false, then the new password hint works also with an obscured text field:

TextFormField(
      autofillHints: const [AutofillHints.newPassword],
      obscureText: true,
      autocorrect: false
    );
TextFormField(
      autofillHints: const [AutofillHints.newPassword],
      obscureText: false,
      autocorrect: true
    );

@ezamagni
Copy link

For some reason it is connected with the autocorrect setting. If you set it to false, then the new password hint works also with an obscured text field:

This doesn't work in my case:
Flutter 3.3.10 with iOS 16.2
Using the sample project with

obscureText: true,
autocorrect: false,

@alexanderFell
Copy link

Same here. In addition, in my case, the "Autofill Credential Provider" does not show a password suggestion for this new password. Flutter 3.7.3

@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 8, 2023
@stuartmorgan stuartmorgan added team-design Owned by Design Languages team triaged-design Triaged by Design Languages team and removed team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 17, 2023
@DylanCross
Copy link

Same issue. Flutter 3.22.1.

The setting autocorrect to false workaround doesn't work for me either.

Maybe useful. I have an autofillgroup with a newPW and confirmPW pair. Both have Autofilhints.newPassword.

If I remove obscure and focus the confirmPW, the it then does suggest a strong password, but then wants to fill the newPW box with an email.

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 customer: flex f: material design flutter/packages/flutter/material repository. found in release: 2.2 Found to occur in 2.2 found in release: 2.3 Found to occur in 2.3 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically team-design Owned by Design Languages team triaged-design Triaged by Design Languages team
Projects
None yet
Development

No branches or pull requests

10 participants