Skip to content

[web] Password field cannot reopen keyboard after toggling obscureText with autofillHints #193267

Closed as duplicate

Description

@simonpham

Steps to reproduce

  1. Run a Flutter Web app on iOS Safari.
  2. Use a password TextField with:
autofillHints: const [AutofillHints.password],
obscureText: obscureText,
  1. Focus the password field. Keyboard appears.
  2. Toggle obscureText.
  3. Unfocus the field.
  4. Tap the password field again.

Expected results

The field regains focus and the keyboard appears.

Actual results

The field appears focused, but the keyboard never appears again.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MaterialApp(home: ReproPage()));
}

class ReproPage extends StatefulWidget {
  const ReproPage({super.key});

  @override
  State<ReproPage> createState() => _ReproPageState();
}

class _ReproPageState extends State<ReproPage> {
  bool obscureText = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(24),
        child: AutofillGroup(
          child: Column(
            children: [
              const TextField(
                autofillHints: [AutofillHints.username],
                decoration: InputDecoration(
                  labelText: 'Username',
                ),
              ),
              TextField(
                autofillHints: const [AutofillHints.password],
                obscureText: obscureText,
                decoration: InputDecoration(
                  labelText: 'Password',
                  suffixIcon: IconButton(
                    onPressed: () {
                      setState(() {
                        obscureText = !obscureText;
                      });
                    },
                    icon: const Icon(Icons.visibility),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Screen.Recording.2026-09-24.at.10.44.19.mov

Logs

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.47.5, on macOS 26.6.1 25G76 darwin-arm64, locale en-VN) [632ms]
    • Flutter version 3.47.5 on channel stable at /Users/simon/.puro/envs/stable/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6a19cca564 (6 days ago), 2026-09-17 14:13:22 -0400
    • Engine revision af7e796e16
    • Dart version 3.13.4
    • 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 37.0.0) [956ms]
    • Android SDK at /Users/simon/Library/Android/sdk
    • Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
    • Platform android-37.2-beta2, build-tools 37.0.0
    • ANDROID_HOME = /Users/simon/Library/Android/sdk
    • Java binary at: /opt/homebrew/opt/openjdk@17/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.15+0)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.4) [1,241ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17E192
    • CocoaPods version 1.16.2

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

Activity

  1. simonpham commented on Sep 24, 2026

    @simonpham
    ContributorAuthor

    Confirmed on:

    Flutter 3.44.9
    Flutter 3.47.5

    Workaround: Removing autofillHints fixes the issue.

    Setup Result
    AutofillGroup + autofillHints ❌ Reproduces
    AutofillGroup without autofillHints ✅ Works
    No AutofillGroup, no autofillHints ✅ Works

    This looks related to #192102, but that issue reproduces without autofill.

  2. added 2 commits that reference this issue on Sep 24, 2026
    92c32c8
    c9c0114
  3. simonpham commented on Sep 24, 2026

    @simonpham
    ContributorAuthor

    this happens on Android (Chrome) as well.

  4. puneetkukreja98 commented on Sep 24, 2026

    @puneetkukreja98
    Contributor

    @simonpham Thanks for reporting the issue. Even after removing autofillgroup and autofillhints it still reproduces on latest stable.

    Tested on ios 26.5 web (iphone 17 simulator).

    I am closing this as a duplicate of #192102.

    Code sample:

    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const MaterialApp(home: ReproPage()));
    }
    
    class ReproPage extends StatefulWidget {
      const ReproPage({super.key});
    
      @override
      State<ReproPage> createState() => _ReproPageState();
    }
    
    class _ReproPageState extends State<ReproPage> {
      bool obscureText = true;
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Padding(
            padding: const EdgeInsets.all(24),
            child: Column(
              children: [
                const TextField(decoration: InputDecoration(labelText: 'Username')),
                TextField(
                  obscureText: obscureText,
                  decoration: InputDecoration(
                    labelText: 'Password',
                    suffixIcon: IconButton(
                      onPressed: () {
                        setState(() {
                          obscureText = !obscureText;
                        });
                      },
                      icon: const Icon(Icons.visibility),
                    ),
                  ),
                ),
              ],
            ),
          ),
        );
      }
    }
    

    flutter doctor -v:

    [✓] Flutter (Channel stable, 3.47.5, on macOS 26.4.1 25E253 darwin-arm64, locale en-US) [663ms]
        • Flutter version 3.47.5 on channel stable at /Users/puneetkukreja/Developer/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 6a19cca564 (7 days ago), 2026-09-17 14:13:22 -0400
        • Engine revision af7e796e16
        • Dart version 3.13.4
        • 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 37.0.0-rc1) [2.8s]
        • Android SDK at /Users/puneetkukreja/Library/Android/sdk
        • Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
        • Platform android-37.1, build-tools 37.0.0-rc1
        • Java binary at: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/java
          This JDK is specified in your Flutter configuration.
          To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 26.6) [1,393ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 17F113
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [6ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (3 available) [12.2s]
        • iPhone 17 (mobile) • CE3DBD4C-6F42-431D-8A89-B02900E8DB24 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-26-5 (simulator)
        • macOS (desktop)    • macos                                • darwin-arm64   • macOS 26.4.1 25E253 darwin-arm64
        • Chrome (web)       • chrome                               • web-javascript • Google Chrome 153.0.8010.53
        ! Error: Browsing on the local area network for Puneet’s 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 [950ms]
        • All expected network resources are available.
    
    • No issues found!
    
  5. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    and removed
    in triagePresently being triaged by the triage team
    on Sep 24, 2026
  6. changed the title [-][web][iOS Safari] Password field cannot reopen keyboard after toggling obscureText with autofillHints[/-] [+][web] Password field cannot reopen keyboard after toggling obscureText with autofillHints[/+] on Sep 24, 2026
  7. simonpham commented on Sep 24, 2026

    @simonpham
    ContributorAuthor

    hi @puneetkukreja98, it does work by removing only the autofillHints of the password TextField:

    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const MaterialApp(home: ReproPage()));
    }
    
    class ReproPage extends StatefulWidget {
      const ReproPage({super.key});
    
      @override
      State<ReproPage> createState() => _ReproPageState();
    }
    
    class _ReproPageState extends State<ReproPage> {
      bool obscureText = true;
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Padding(
            padding: const EdgeInsets.all(24),
            child: AutofillGroup(
              child: Column(
                children: [
                  const TextField(
                    autofillHints: [AutofillHints.username],
                    decoration: InputDecoration(
                      labelText: 'Username',
                    ),
                  ),
                  TextField(
                    // autofillHints: const [AutofillHints.password], <-- only remmove this
                    obscureText: obscureText,
                    decoration: InputDecoration(
                      labelText: 'Password',
                      suffixIcon: IconButton(
                        onPressed: () {
                          setState(() {
                            obscureText = !obscureText;
                          });
                        },
                        icon: const Icon(Icons.visibility),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        );
      }
    }
  8. github-actions commented on Oct 8, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Oct 8, 2026
  10. added a commit that references this issue on Oct 8, 2026
    4c15b12
  11. added a commit that references this issue on Oct 29, 2026
    1910116
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions