Skip to content

[iOS] Keyboard dismisses and reopens when switching focus between TextFields - regression in 3.41.0 #184875

Closed

Description

@nixonoftheyear

Flutter version

  • Affected: 3.41.0 → 3.41.6
  • Not affected: 3.38.10 (and presumably earlier)

Platform

iOS (physical device and simulator). Not tested on Android.

Describe the bug

When switching focus between TextField widgets — either by tapping directly on another field or by pressing the "Next" key on the keyboard — the keyboard briefly dismisses and reopens instead of staying visible with only the focus changing.

This is a regression: the same screen and code works correctly on Flutter 3.38.10 without any workarounds.

Steps to reproduce

  1. Create a screen with 2+ TextField widgets in sequence, with TextInputAction.next on all but the last
  2. Run on a physical iOS device (or simulator)
  3. Tap the first TextField → keyboard appears
  4. Tap the second TextField directly → keyboard flashes (closes and reopens)
  5. Alternatively, press the "Next" key on the keyboard → same flash, more noticeable

Expected behavior

Keyboard stays visible, only the focus moves to the next field — as it did on Flutter 3.38.10.

Actual behavior

The keyboard briefly dismisses and reopens on every focus change between fields. The flash is particularly noticeable when using the "Next" key.

Minimal reproduction

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: KeyboardRegressionScreen());
  }
}

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

  @override
  State<KeyboardRegressionScreen> createState() => _KeyboardRegressionScreenState();
}

class _KeyboardRegressionScreenState extends State<KeyboardRegressionScreen> {
  final _firstNameFocus = FocusNode();
  final _lastNameFocus = FocusNode();
  final _phoneFocus = FocusNode();

  @override
  void dispose() {
    _firstNameFocus.dispose();
    _lastNameFocus.dispose();
    _phoneFocus.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Padding(
        padding: const EdgeInsets.all(24.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            TextField(
              focusNode: _firstNameFocus,
              textInputAction: TextInputAction.next,
              decoration: const InputDecoration(labelText: 'Nome'),
              onSubmitted: (_) => _lastNameFocus.requestFocus(),
            ),
            const SizedBox(height: 16),
            TextField(
              focusNode: _lastNameFocus,
              textInputAction: TextInputAction.next,
              decoration: const InputDecoration(labelText: 'Cognome'),
              onSubmitted: (_) => _phoneFocus.requestFocus(),
            ),
            const SizedBox(height: 16),
            TextField(
              focusNode: _phoneFocus,
              textInputAction: TextInputAction.done,
              keyboardType: TextInputType.phone,
              decoration: const InputDecoration(labelText: 'Telefono'),
            ),
          ],
        ),
      ),
    );
  }
}

Additional context

  • Confirmed regression by downgrading to Flutter 3.38.10: issue disappears completely without any code changes
  • The iOS console shows NSLayoutConstraint warnings related to TUIKeyboardContentView during the transition — these were not present on 3.38.10
  • Tested on a screen using standard TextField with FocusNodes and TextInputAction.next

Activity

  1. puneetkukreja98 commented on Apr 10, 2026

    @puneetkukreja98
    Contributor

    @nixonoftheyear Thanks for reporting the issue. The fix for this has already been merged into the master branch #180842

    It hasn't reached the stable channel yet, but I've verified it on the master branch and the issue is no longer reproducible—it's working fine.

    Please wait a few weeks ,it should be available on the stable channel soon.

    Thanks

    Flutter doctor -v:

    [✓] Flutter (Channel master, 3.43.0-1.0.pre-535, on macOS 26.4 25E246 darwin-arm64, locale en-US) [2.5s]
        • Flutter version 3.43.0-1.0.pre-535 on channel master at /Users/puneetkukreja/flutter-contribution/flutter
        • Upstream repository https://github.com/puneetkukreja98/flutter
        • FLUTTER_GIT_URL = https://github.com/puneetkukreja98/flutter
        • Framework revision d996d16d7e (4 hours ago), 2026-04-09 09:07:31 +0200
        • Engine revision 721a6b5d3e
        • Dart version 3.12.0 (build 3.12.0-327.1.beta)
        • DevTools version 2.57.0
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager,
          omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [3.1s]
        • Android SDK at /Users/puneetkukreja/Library/Android/sdk
        • Emulator version 36.5.10.0 (build_id 15081367) (CL:N/A)
        • Platform android-36.1, build-tools 36.1.0
        • 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.4) [1,539ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 17E192
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [7ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (4 available) [8.0s]
        • sdk gphone64 arm64 (mobile) • emulator-5554                        • android-arm64  • Android 16 (API 36) (emulator)
        • iPhone Air (mobile)         • 11DBDF31-0164-4C37-9ECD-4BF2181A34AC • ios            • com.apple.CoreSimulator.SimRuntime.iOS-26-4 (simulator)
        • macOS (desktop)             • macos                                • darwin-arm64   • macOS 26.4 25E246 darwin-arm64
        • Chrome (web)                • chrome                               • web-javascript • Google Chrome 146.0.7680.178
        ! 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 [524ms]
        • All expected network resources are available.
    
    • No issues found!
    
  2. added
    r: solvedIssue is closed as solved
    and removed
    in triagePresently being triaged by the triage team
    on Apr 10, 2026
  3. github-actions commented on Apr 24, 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.

  4. locked as resolved and limited conversation to collaborators on Apr 24, 2026
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: solvedIssue is closed as solved

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions