Skip to content

[web] Keyboard input stops working after toggling obscureText via suffixIcon and blurring the field #192102

Closed

Description

@shorbenko

Steps to reproduce

Run the sample below on Flutter Web (Chrome).

  1. Click the password field and type some text.
  2. Click the visibility icon in suffixIcon to toggle obscureText to false.
  3. Click outside the field (or press Tab) to blur it.
  4. Click the text field again (or another text field) and try typing.
  5. Repeat steps 1-4 several times

Expected results

The field should accept keyboard input normally after toggling visibility and blurring/refocusing.

Actual results

Keyboard input no longer works. The field may appear focused (cursor visible) but keystrokes are not received.

Code sample

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(colorScheme: .fromSeed(seedColor: Colors.deepPurple)),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool _obscureText = true;

  void _toggleObscureText() {
    setState(() {
      _obscureText = !_obscureText;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: .center,
          children: [
            TextField(
              obscureText: _obscureText,
              decoration: InputDecoration(
                suffixIcon: InkWell(
                  onTap: _toggleObscureText,
                  child: _obscureText
                      ? const Icon(Icons.visibility)
                      : const Icon(Icons.visibility_off),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screen.Recording.2026-09-01.at.10.55.30.mov

Video demonstration

Logs

Logs
/Users/shorben/Documents/Projects/flutter/bin/flutter --no-color run --machine --track-widget-creation --device-id=chrome --start-paused --dart-define=flutter.inspector.structuredErrors=true --devtools-server-address=http://127.0.0.1:9102 lib/main.dart
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
This app is linked to the debug service: ws://127.0.0.1:61298/RqGk-dz483o=/ws
Debug service listening on ws://127.0.0.1:61298/RqGk-dz483o=/ws
A Dart VM Service on Chrome is available at: http://127.0.0.1:61298/RqGk-dz483o=
The Flutter DevTools debugger and profiler on Chrome is available at: http://127.0.0.1:9102?uri=ws://127.0.0.1:61298/RqGk-dz483o=/ws
Debug service listening on ws://127.0.0.1:61298/RqGk-dz483o=/ws
Starting application from main method in: org-dartlang-app:///web_entrypoint.dart.

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.47.2, on macOS 26.6.2 25G83 darwin-arm64, locale
    en-UA) [387ms]
    • Flutter version 3.47.2 on channel stable at
      /Users/shorben/Documents/Projects/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3b14c8769 (5 days ago), 2026-08-26 16:07:51 -0700
    • Engine revision a804b26164
    • Dart version 3.13.2
    • 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.1.0)
    [666ms]
    • Android SDK at /Users/shorben/Library/Android/sdk
    • Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
    • Platform android-36.1, build-tools 36.1.0
    • ANDROID_HOME = /Users/shorben/Library/Android/sdk
    • 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.2+-15348964-b329.117)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 26.2) [814ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17C52
    • CocoaPods version 1.16.2

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

[✓] Connected device (4 available) [5.9s]
    • Serhii’s iPhone (mobile)            • 00008130-0002402A3A92001C            • ios            • iOS 26.6 23G71
    • iPhone SE (3rd generation) (mobile) • AB18A93F-6D2E-4102-8475-5C11B22E33CD • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-26-2 (simulator)
    • macOS (desktop)                     • macos                                • darwin-arm64   • macOS 26.6.2 25G83
      darwin-arm64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 152.0.7977.65

[✓] Network resources [853ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. saurabh-mirajkar commented on Sep 1, 2026

    @saurabh-mirajkar
    Contributor

    @shorbenko Thanks for the report. Labelling for team to investigate further.

  2. added
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    platform-webWeb applications specifically
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    fyi-webFor the attention of Web platform team
    and removed
    in triagePresently being triaged by the triage team
    on Sep 1, 2026
  3. added
    P2Important issues not at the top of the work list
    on Sep 3, 2026
  4. justinmc commented on Sep 3, 2026

    @justinmc
    Contributor

    @saurabh-mirajkar Could you try this on one or two older versions of Flutter and see if the bug still exists? I'm wondering if this is a regression or not. Maybe try before PR #183488, which could be related.

    Also, are we sure this is web only?

    I'm wondering if this has to do with focus or the TextInputConnection getting closed and not reopened.

  5. 17 remaining items

  6. added
    P1High-priority issues at the top of the work list
    team-webOwned by Web platform team
    triaged-webTriaged by Web platform team
    and removed
    team-webOwned by Web platform team
    platform-webWeb applications specifically
    P1High-priority issues at the top of the work list
    on Oct 8, 2026
  7. flutter-zl commented on Oct 8, 2026

    @flutter-zl
    Contributor

    This is the same root cause as #192544. Toggling obscureText sends TextInput.updateConfig to the web engine, which then drops the field's hidden input instead of saving its form for reuse. The field only dies after its form has been reused once, which is why the steps need a few rounds. The form reuse came from #182024, which matches the 3.41.9 to 3.44.x regression window.

    #194015 fixes both. Demo with this issue's sample as Field C:
    Before: https://flutter-demo-74-before.web.app
    After: https://flutter-demo-74-after.web.app

  8. added a commit that references this issue on Oct 8, 2026
    4c15b12
  9. github-actions commented on Oct 22, 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.

  10. locked as resolved and limited conversation to collaborators on Oct 22, 2026
  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

Labels

P1High-priority issues at the top of the work listteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions