Skip to content

IOS TextField focus switching bug when using auto fill  #69129

@britannio

Description

@britannio

Steps to Reproduce

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'TextField Focus Bug Reproduction',
      home: Scaffold(
        appBar: AppBar(title: Text('TextField Focus Bug Reproduction')),
        body: AutofillGroup(
          child: Column(
            children: <Widget>[
              TextField(
                textInputAction: TextInputAction.next,
                autofillHints: [AutofillHints.givenName],
              ),
              TextField(autofillHints: [AutofillHints.email])
            ],
          ),
        ),
      ),
    );
  }
}
  1. Run the above snippet on an IOS device
  2. Select the first text field
  3. Tap the next button on the keyboard

Expected results:
The second text field should gain focus and remain focused.
Actual results:
The second text field briefly gains focus before returning focus to the first text field.

Expected behaviour(Android)

ezgif com-gif-maker (1)

Actual behaviour(IOS)

ezgif com-gif-maker
It's only focusing on the second text field if I manually tap it.

Logs
Analyzing form...                                                       
No issues found! (ran in 2.0s)
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.6 19G2021, locale en-GB)
    • Flutter version 1.22.2 at /Users/britannio/development/flutter
    • Framework revision 84f3d28555 (12 days ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/britannio/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[!] IntelliJ IDEA Community Edition (version 2020.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

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

[✓] Connected device (2 available)
    • GM1913 (mobile)             • 88a6947b                                 • android-arm64 • Android 10 (API 29)
    • Britannio’s iPhone (mobile) • 3f381cb8dd2e36d6caf2270cc1a31b6fcb887fa3 • ios           • iOS 14.1
    ! Error: Britannio’s iPhone is busy: Copying cache files from device. Xcode will continue when Britannio’s iPhone is finished. (code
      -10)

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsf: focusFocus traversal, gaining or losing focusf: material designflutter/packages/flutter/material repository.found in release: 1.22Found to occur in 1.22frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions