Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[web] Textfield 'autofocus: true' doesn't show up the keyboard #58498

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

Open
tomasbaran opened this issue Jun 2, 2020 · 54 comments
Open

[web] Textfield 'autofocus: true' doesn't show up the keyboard #58498

tomasbaran opened this issue Jun 2, 2020 · 54 comments
Labels
a: text input Entering text in a text field or keyboard related problems browser: chrome-android only manifests in Chrome on Android browser: safari-ios only manifests in Safari on iOS customer: crowd Affects or could affect many people, though not necessarily a specific customer. f: focus Focus traversal, gaining or losing focus found in release: 3.19 Found to occur in 3.19 found in release: 3.20 Found to occur in 3.20 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P3 Issues that are less important to the Flutter project platform-web Web applications specifically team-web Owned by Web platform team triaged-web Triaged by Web platform team workaround available There is a workaround available to overcome the issue

Comments

@tomasbaran
Copy link

tomasbaran commented Jun 2, 2020

It only gets in the focused mode which I know by changing the TextField focusedBorder property that it's being listened to but no keyboard there.

doctor
[✓] Flutter (Channel dev, 1.19.0-2.0.pre, on Mac OS X 10.15.5 19F101, locale es-ES)
    • Flutter version 1.19.0-2.0.pre at /Users/tomas/Development/flutter
    • Framework revision 1d395c5e18 (2 days ago), 2020-05-31 07:41:50 -0700
    • Engine revision 923687f0e7
    • Dart version 2.9.0 (build 2.9.0-11.0.dev 6489a0c68d)


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/tomas/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.1

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

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

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

[✓] Connected device (3 available)
    • iPhone 11  • 04298E38-2633-4586-B868-1FBD5C708AF7 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)
    • Web Server • web-server                           • web-javascript • Flutter Tools
    • Chrome     • chrome                               • web-javascript • Google Chrome 83.0.4103.61

• No issues found!
@tomasbaran tomasbaran changed the title Textfield 'autofocus: true' doesn't show up the keyboard web version Textfield 'autofocus: true' doesn't show up the keyboard (web version) Jun 2, 2020
@iapicca
Copy link
Contributor

iapicca commented Jun 3, 2020

Hi @tomasbaran
Can you please provide a minimal complete reproducible code sample.
Thank you

@iapicca iapicca added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Jun 3, 2020
@tomasbaran
Copy link
Author

tomasbaran commented Jun 3, 2020

Sure, it's just adding Textfield:

TextField(autofocus: true),

If you want to see the focusedBorder difference:

TextField(
              autofocus: true,
              decoration: InputDecoration(
                focusedBorder: OutlineInputBorder(
                  borderSide: BorderSide(color: Colors.pink),
                ),
                enabledBorder: OutlineInputBorder(
                  borderSide: BorderSide(color: Colors.green),
                ),
              ),
            ),
Full Sample Code (default counter app) import 'package:flutter/material.dart';
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
        // This makes the visual density adapt to the platform that you run
        // the app on. For desktop platforms, the controls will be smaller and
        // closer together (more dense) than on mobile platforms.
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
              autofocus: true,
              decoration: InputDecoration(
                focusedBorder: OutlineInputBorder(
                  borderSide: BorderSide(color: Colors.pink),
                ),
                enabledBorder: OutlineInputBorder(
                  borderSide: BorderSide(color: Colors.green),
                ),
              ),
            ),
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Try the sample code in chrome flutter run -d chrome on iPhone SE - simulator (iOS 12) in Safari to see the issue. The issue is not present on iPhone XR - simulator BUT IT IS present on the real iPhone XR (iOS 13.5).

Simulator Screen Shot - iPhone SE (1st generation) - 2020-06-03 at 08 24 27

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 3, 2020
@iapicca
Copy link
Contributor

iapicca commented Jun 3, 2020

Hi @tomasbaran
I tested your code with the latest master
and I encounter the behaviour you are describing

logs
[  +21 ms] executing: [/Users/nevercode/development/flutter_master/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +195 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +67 ms] 2ece1c3a174c3dd7099736f13b4ad16bb9b70c1d
[   +2 ms] executing: [/Users/nevercode/development/flutter_master/] git tag --contains HEAD
[+1085 ms] Exit code 0 from: git tag --contains HEAD
[   +5 ms] executing: [/Users/nevercode/development/flutter_master/] git describe --match *.*.*-*.*.pre --first-parent --long --tags
[  +74 ms] Exit code 0 from: git describe --match *.*.*-*.*.pre --first-parent --long --tags
[   +2 ms] 1.19.0-3.0.pre-20-g2ece1c3a1
[  +25 ms] executing: [/Users/nevercode/development/flutter_master/] git rev-parse --abbrev-ref --symbolic @{u}
[  +28 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/master
[        ] executing: [/Users/nevercode/development/flutter_master/] git ls-remote --get-url origin
[  +26 ms] Exit code 0 from: git ls-remote --get-url origin
[   +1 ms] https://github.com/flutter/flutter.git
[ +174 ms] executing: [/Users/nevercode/development/flutter_master/] git rev-parse --abbrev-ref HEAD
[  +23 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] master
[  +21 ms] executing: sw_vers -productName
[  +52 ms] Exit code 0 from: sw_vers -productName
[        ] Mac OS X
[        ] executing: sw_vers -productVersion
[  +36 ms] Exit code 0 from: sw_vers -productVersion
[   +4 ms] 10.15.4
[   +2 ms] executing: sw_vers -buildVersion
[  +36 ms] Exit code 0 from: sw_vers -buildVersion
[   +1 ms] 19E287
[ +133 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[  +36 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +52 ms] executing: /Users/nevercode/Library/Android/sdk/platform-tools/adb devices -l
[  +33 ms] executing: /usr/bin/xcode-select --print-path
[  +26 ms] Exit code 0 from: /usr/bin/xcode-select --print-path
[        ] /Applications/Xcode.app/Contents/Developer
[   +6 ms] executing: /usr/bin/xcodebuild -version
[+1397 ms] Exit code 0 from: /usr/bin/xcodebuild -version
[        ] Xcode 11.3.1
           Build version 11C504
[   +9 ms] executing: xcrun --find xcdevice
[  +23 ms] Exit code 0 from: xcrun --find xcdevice
[        ] /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice
[        ] executing: xcrun xcdevice list --timeout 2
[  +10 ms] /usr/bin/xcrun simctl list --json devices
[        ] executing: /usr/bin/xcrun simctl list --json devices
[  +71 ms] List of devices attached
           965AY0WP5C             device usb:337641472X product:sargo model:Pixel_3a device:sargo transport_id:1
[ +118 ms] {
                      "devices" : {
                        "com.apple.CoreSimulator.SimRuntime.watchOS-6-1" : [
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "Apple Watch Series 4 - 40mm",
                            "udid" : "7F389A7F-C267-412A-8DB8-63A83386A06F"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "Apple Watch Series 4 - 44mm",
                            "udid" : "3568E5A3-98A0-414B-9A79-5CC234FA6E2B"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "Apple Watch Series 5 - 40mm",
                            "udid" : "3B543693-444A-4E3D-BD8A-9BD2AE2EDD2F"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "Apple Watch Series 5 - 44mm",
                            "udid" : "AF6A4F31-535E-4FE6-A062-49A81AB5AAE3"
                          }
                        ],
                        "com.apple.CoreSimulator.SimRuntime.tvOS-13-3" : [
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "Apple TV",
                            "udid" : "8EC4E84F-BA3E-4251-8351-8324AC08E126"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "Apple TV 4K",
                            "udid" : "8FFD5279-9EEA-49AE-83CA-8736CB3E61AB"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "Apple TV 4K (at 1080p)",
                            "udid" : "8A1D2EC5-B2B9-474D-81DF-E6A3D0DB84EF"
                          }
                        ],
                        "com.apple.CoreSimulator.SimRuntime.iOS-13-3" : [
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPhone 8",
                            "udid" : "D5F70F31-B488-4454-9539-320B5551D92A"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPhone 8 Plus",
                            "udid" : "62B827A3-68BD-46BD-8E92-DE5297DF3840"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPhone 11",
                            "udid" : "D1B95CB0-D10B-4983-9AFE-6DB7C4006D15"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPhone 11 Pro",
                            "udid" : "8B67BA47-2EED-4956-B383-17112E09F7BC"
                          },
                          {
                            "state" : "Booted",
                            "isAvailable" : true,
                            "name" : "iPhone 11 Pro Max",
                            "udid" : "A1664A8D-8DB6-4659-B012-18746A2DB8C3"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPad Pro (9.7-inch)",
                            "udid" : "A7BC437A-C1AB-4DDC-B723-5BC2411FF606"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPad (7th generation)",
                            "udid" : "50905834-EA49-46D1-9282-2BFD80B002C9"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPad Pro (11-inch)",
                            "udid" : "C37B8020-20B5-44D3-BB6B-1E34569A3E57"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPad Pro (12.9-inch) (3rd generation)",
                            "udid" : "BBD1E939-BE74-444C-825D-6DA528EF37D0"
                          },
                          {
                            "state" : "Shutdown",
                            "isAvailable" : true,
                            "name" : "iPad Air (3rd generation)",
                            "udid" : "609AAB06-1510-466F-82F8-1951E7EAFCD2"
                          }
                        ]
                      }
                    }
[+4859 ms] [
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17K446)",
                        "available" : true,
                        "platform" : "com.apple.platform.appletvsimulator",
                        "modelCode" : "AppleTV6,2",
                        "identifier" : "8FFD5279-9EEA-49AE-83CA-8736CB3E61AB",
                        "architecture" : "x86_64",
                        "modelName" : "Apple TV 4K",
                        "name" : "Apple TV 4K"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPad8,1",
                        "identifier" : "C37B8020-20B5-44D3-BB6B-1E34569A3E57",
                        "architecture" : "x86_64",
                        "modelName" : "iPad Pro (11-inch)",
                        "name" : "iPad Pro (11-inch)"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17K446)",
                        "available" : true,
                        "platform" : "com.apple.platform.appletvsimulator",
                        "modelCode" : "AppleTV6,2",
                        "identifier" : "8A1D2EC5-B2B9-474D-81DF-E6A3D0DB84EF",
                        "architecture" : "x86_64",
                        "modelName" : "Apple TV 4K (at 1080p)",
                        "name" : "Apple TV 4K (at 1080p)"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPhone12,5",
                        "identifier" : "A1664A8D-8DB6-4659-B012-18746A2DB8C3",
                        "architecture" : "x86_64",
                        "modelName" : "iPhone 11 Pro Max",
                        "name" : "iPhone 11 Pro Max"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPad6,4",
                        "identifier" : "A7BC437A-C1AB-4DDC-B723-5BC2411FF606",
                        "architecture" : "x86_64",
                        "modelName" : "iPad Pro (9.7-inch)",
                        "name" : "iPad Pro (9.7-inch)"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "6.1.1 (17S445)",
                        "available" : true,
                        "platform" : "com.apple.platform.watchsimulator",
                        "modelCode" : "Watch4,4",
                        "identifier" : "3568E5A3-98A0-414B-9A79-5CC234FA6E2B",
                        "architecture" : "i386",
                        "modelName" : "Apple Watch Series 4 - 44mm",
                        "name" : "Apple Watch Series 4 - 44mm"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPad11,3",
                        "identifier" : "609AAB06-1510-466F-82F8-1951E7EAFCD2",
                        "architecture" : "x86_64",
                        "modelName" : "iPad Air (3rd generation)",
                        "name" : "iPad Air (3rd generation)"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17K446)",
                        "available" : true,
                        "platform" : "com.apple.platform.appletvsimulator",
                        "modelCode" : "AppleTV5,3",
                        "identifier" : "8EC4E84F-BA3E-4251-8351-8324AC08E126",
                        "architecture" : "x86_64",
                        "modelName" : "Apple TV",
                        "name" : "Apple TV"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPhone10,4",
                        "identifier" : "D5F70F31-B488-4454-9539-320B5551D92A",
                        "architecture" : "x86_64",
                        "modelName" : "iPhone 8",
                        "name" : "iPhone 8"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPad8,5",
                        "identifier" : "BBD1E939-BE74-444C-825D-6DA528EF37D0",
                        "architecture" : "x86_64",
                        "modelName" : "iPad Pro (12.9-inch) (3rd generation)",
                        "name" : "iPad Pro (12.9-inch) (3rd generation)"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPhone12,3",
                        "identifier" : "8B67BA47-2EED-4956-B383-17112E09F7BC",
                        "architecture" : "x86_64",
                        "modelName" : "iPhone 11 Pro",
                        "name" : "iPhone 11 Pro"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "6.1.1 (17S445)",
                        "available" : true,
                        "platform" : "com.apple.platform.watchsimulator",
                        "modelCode" : "Watch5,3",
                        "identifier" : "3B543693-444A-4E3D-BD8A-9BD2AE2EDD2F",
                        "architecture" : "i386",
                        "modelName" : "Apple Watch Series 5 - 40mm",
                        "name" : "Apple Watch Series 5 - 40mm"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPhone10,5",
                        "identifier" : "62B827A3-68BD-46BD-8E92-DE5297DF3840",
                        "architecture" : "x86_64",
                        "modelName" : "iPhone 8 Plus",
                        "name" : "iPhone 8 Plus"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPhone12,1",
                        "identifier" : "D1B95CB0-D10B-4983-9AFE-6DB7C4006D15",
                        "architecture" : "x86_64",
                        "modelName" : "iPhone 11",
                        "name" : "iPhone 11"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "13.3 (17C45)",
                        "available" : true,
                        "platform" : "com.apple.platform.iphonesimulator",
                        "modelCode" : "iPad7,12",
                        "identifier" : "50905834-EA49-46D1-9282-2BFD80B002C9",
                        "architecture" : "x86_64",
                        "modelName" : "iPad (7th generation)",
                        "name" : "iPad (7th generation)"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "6.1.1 (17S445)",
                        "available" : true,
                        "platform" : "com.apple.platform.watchsimulator",
                        "modelCode" : "Watch4,3",
                        "identifier" : "7F389A7F-C267-412A-8DB8-63A83386A06F",
                        "architecture" : "i386",
                        "modelName" : "Apple Watch Series 4 - 40mm",
                        "name" : "Apple Watch Series 4 - 40mm"
                      },
                      {
                        "simulator" : true,
                        "operatingSystemVersion" : "6.1.1 (17S445)",
                        "available" : true,
                        "platform" : "com.apple.platform.watchsimulator",
                        "modelCode" : "Watch5,4",
                        "identifier" : "AF6A4F31-535E-4FE6-A062-49A81AB5AAE3",
                        "architecture" : "i386",
                        "modelName" : "Apple Watch Series 5 - 44mm",
                        "name" : "Apple Watch Series 5 - 44mm"
                      }
                    ]
[  +23 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +669 ms] Generating /Users/nevercode/Desktop/projects/master/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +705 ms] Launching lib/main.dart on Chrome in debug mode...
[ +900 ms] Updating assets
[ +407 ms] Syncing files to device Chrome...
[ +231 ms] Generating /Users/nevercode/Desktop/projects/master/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +97 ms] <- reset
[  +80 ms] /Users/nevercode/development/flutter_master/bin/cache/dart-sdk/bin/dart
/Users/nevercode/development/flutter_master/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot --sdk-root
/Users/nevercode/development/flutter_master/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names -Ddart.developer.causal_async_stacks=true
--output-dill /var/folders/c3/l5jpznsj5k37yrj47l__xpw40000gn/T/flutter_tools.EdIapP/flutter_tool.yWo95U/app.dill --libraries-spec
file:///Users/nevercode/development/flutter_master/bin/cache/flutter_web_sdk/libraries.json --packages .packages -Ddart.vm.profile=false -Ddart.vm.product=false
--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts
--track-widget-creation --filesystem-root /var/folders/c3/l5jpznsj5k37yrj47l__xpw40000gn/T/flutter_tools.EdIapP/flutter_tools.mAbimx --filesystem-scheme org-dartlang-app
--initialize-from-dill build/cache.dill.track.dill --platform file:///Users/nevercode/development/flutter_master/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk.dill
[  +33 ms] <- compile org-dartlang-app:/web_entrypoint.dart
[+28735 ms] Syncing files to device Chrome... (completed in 29,166ms, longer than expected)
[   +1 ms] Synced 22.7MB.
[   +1 ms] <- accept
[+1239 ms] [CHROME]:
[  +13 ms] [CHROME]:DevTools listening on ws://127.0.0.1:61169/devtools/browser/b96fe5f1-97ce-4455-8b12-ce40a44e8c8d
[+5578 ms] Debug service listening on ws://127.0.0.1:61191/P5VCyZTelU4=

[ +682 ms] Debug service listening on ws://127.0.0.1:61191/P5VCyZTelU4=
[   +3 ms] Warning: Flutter's support for web development is not stable yet and hasn't
[        ] been thoroughly tested in production environments.
[        ] For more information see https://flutter.dev/web
[        ] 🔥  To hot restart changes while running, press "r" or "R".
[   +1 ms] For a more detailed help message, press "h". To quit, press "q".
[+41247 ms] Stopped debug service on ws://127.0.0.1:61191

[ +423 ms] Application finished.
[   +4 ms] "flutter run" took 87,799ms.
[ +300 ms] Running shutdown hooks
[   +2 ms] Shutdown hook priority 4
[ +773 ms] Shutdown hooks complete
doctor
[✓] Flutter (Channel master, 1.19.0-4.0.pre.20, on Mac OS X 10.15.4 19E287, locale en-GB)
    • Flutter version 1.19.0-4.0.pre.20 at /Users/nevercode/development/flutter_master
    • Framework revision 2ece1c3a17 (10 hours ago), 2020-06-02 19:00:12 -0700
    • Engine revision 6589dcb2d4
    • Dart version 2.9.0 (build 2.9.0-13.0.dev 3d53df52af)


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/nevercode/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.9.0

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

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.11.0

[✓] Connected device (4 available)
    • Pixel 3a          • 965AY0WP5C                           • android-arm64  • Android 10 (API 29)
    • iPhone 11 Pro Max • A1664A8D-8DB6-4659-B012-18746A2DB8C3 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
    • Web Server        • web-server                           • web-javascript • Flutter Tools
    • Chrome            • chrome                               • web-javascript • Google Chrome 83.0.4103.61

• No issues found!

screenshot

Thank you

@iapicca iapicca added a: text input Entering text in a text field or keyboard related problems f: focus Focus traversal, gaining or losing focus found in release: 1.19 Found to occur in 1.19 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-web Web applications specifically and removed in triage Presently being triaged by the triage team labels Jun 3, 2020
@tomasbaran
Copy link
Author

tomasbaran commented Jun 3, 2020

Since this issue is also present on iOS12 and on iPhone SE, it may be related to these issues (which are also present only on iOS12 on iPhone SE: #58510 and #58518

@iapicca iapicca added the browser: safari-macos only manifests in Safari on macOS label Jun 5, 2020
@yjbanov yjbanov added P3 Issues that are less important to the Flutter project and removed P2 Important issues not at the top of the work list labels Jun 16, 2020
@deandreamatias
Copy link

deandreamatias commented Jun 17, 2020

I have the same issue with autofocus: true :

  • Page to test: https://tvrandshow.com
  • Device: iPhone 6 with 12.4.7 iOS
  • Browser: Safari, Chrome 83.0 and partially in Firefox 26.0

The special situation in Firefox is:

  • The first time than load page, the autofocus dont work, but I can open the keyboard. But, when navigate to another page and back to page with autofocus, I can't open the keyboard.

@tomasbaran
Copy link
Author

@deandreamatias If you want to issue to be fixed sooner, it's also worth to +1 (thumb up) on the original issue. Just in case, you didn't know.

@tomasbaran
Copy link
Author

Anyone found any workaround for this, please?

@deandreamatias
Copy link

Anyone found any workaround for this, please?

You try with lastest flutter beta version @tomasbaran ?

@tomasbaran
Copy link
Author

@deandreamatias Sure, I tried it on the latest beta as well as on the latest master. Why are you asking? Was it working for you on the latest beta?

@deandreamatias
Copy link

Don't work for me, but is nice know to Flutter team

@tomasbaran
Copy link
Author

tomasbaran commented Aug 26, 2020

Not even doing it manually helps with focusNode:

FocusNode _focusNode;

 @override
  void initState() {
    super.initState();
    _focusNode = FocusNode();
    _focusNode.requestFocus();
  }
TextField(
focusNode: _focusNode;
)

Maybe that's what's causing the issue in the first place. Doesn't autofocus: true just do what my code above does with the focusNode? I mean, isn't autofocus: true kind of a shortcut for the code above? If so, we found the root of the problem...

@tomasbaran tomasbaran changed the title Textfield 'autofocus: true' doesn't show up the keyboard (web version) [web] Textfield 'autofocus: true' doesn't show up the keyboard Aug 26, 2020
@flutter-triage-bot flutter-triage-bot bot added team-web Owned by Web platform team triaged-web Triaged by Web platform team labels Jul 8, 2023
@wilsonborba
Copy link

none of these choices above worked;

If I set autofocus to true, the keyboard appears, but I can't switch to the next TextFormField. If I set it to request focus on tap, setting the focus node doesn't work either (appears and disappear).

tried open in:
iPhone 11 safari, iOS 16.3.1

flutter version:
Flutter 3.13.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 12fccda (4 days ago) • 2023-09-19 13:56:11 -0700
Engine • revision bd986c5ed2
Tools • Dart 3.1.2 • DevTools 2.25.0

@TroyTheGod
Copy link

having the same issue here, it only response to a user action.
wondering if this is some "behaviour" of safari?

@iapicca
Copy link
Contributor

iapicca commented Oct 20, 2023

@huycozy
is this p3 meant to be the old "it-is-on-the-radar" P3 or the new "nobody-is-looking-at-this-right-now" P3

@darshankawar
Copy link
Member

Verified this issue using latest master and stable versions and observed that the originally reported issue persists, as shown below:

Screenshot 2024-02-16 at 4 12 30 PM

Even though the textfield shows the cursor blinking, the keyboard doesn't by default open. Although, upon tapping in the textfield, it shows up the keyboard.

stable, master flutter doctor -v
[!] Flutter (Channel stable, 3.19.0, on macOS 12.2.1 21D62 darwin-x64, locale
    en-GB)
    • Flutter version 3.19.0 on channel stable at
      /Users/dhs/documents/fluttersdk/flutter
    ! Warning: `flutter` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
      your current Flutter SDK checkout at
      /Users/dhs/documents/fluttersdk/flutter. Consider adding
      /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
      Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
      of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision bae5e49bc2 (2 days ago), 2024-02-13 17:46:18 -0800
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

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

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

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

[!] Flutter (Channel master, 3.20.0-7.0.pre.82, on macOS 12.2.1 21D62
    darwin-x64, locale en-GB)
    • Flutter version 3.20.0-7.0.pre.82 on channel master at
      /Users/dhs/documents/fluttersdk/flutter
    ! Warning: `flutter` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
      your current Flutter SDK checkout at
      /Users/dhs/documents/fluttersdk/flutter. Consider adding
      /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
      Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
      of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6f6950b12b (26 minutes ago), 2024-02-15 20:35:36 -0800
    • Engine revision 7de84271eb
    • Dart version 3.4.0 (build 3.4.0-147.0.dev)
    • DevTools version 2.33.0-dev.6
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/dhs/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13C100
    • CocoaPods version 1.11.2

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

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 65.1.4
    • Dart plugin version 213.7228

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

[✓] Connected device (3 available)
    • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
      • iOS 15.3.1 19D52
    • macOS (desktop)           • macos                                    •
      darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)              • chrome                                   •
      web-javascript • Google Chrome 109.0.5414.119

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

! Doctor found issues in 1 category.
      
[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

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

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

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.



@darshankawar darshankawar added found in release: 3.19 Found to occur in 3.19 found in release: 3.20 Found to occur in 3.20 and removed found in release: 1.26 Found to occur in 1.26 labels Feb 16, 2024
@UnkwUsr
Copy link

UnkwUsr commented Feb 17, 2024

I want to bump @geronsv workaround and confirm that it worked for me too (on Android)

Deleting autofocus: true and setting the focus after a delay worked for me - link

#58498 (comment)

@wilsonborba
Copy link

Coming back to say that the functionality across Safari, Firefox, Chrome, and Edge is working now. Thx folks.

I tried open it using iPhone 11, iOS 16.3.1, u guys can check at wojo.club ...

Flutter 3.16.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 4145645 (10 weeks ago) • 2024-01-25 10:06:23 -0800
Engine • revision f40e976bed
Tools • Dart 3.2.6 • DevTools 2.28.5

@Keetz
Copy link

Keetz commented Apr 24, 2024

I have issues on the following:

Flutter 3.19.6 (stable)
iOS 17.4.1
iPhone 13 mini

The keyboard doesn't show automatically with a TextField(autofocus: true).

On Android in both Chrome and Firefox it works fine, tested on two different devices.

Test app:

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: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              child: const Text('Dialog'),
              onPressed: () {
                showDialog(
                  context: context,
                  builder: (context) {
                    return const AlertDialog(
                      content: TextField(autofocus: true),
                    );
                  },
                );
              },
            ),
            ElevatedButton(
              child: const Text('Modal'),
              onPressed: () {
                showModalBottomSheet(
                  context: context,
                  builder: (context) {
                    return Padding(
                      padding: EdgeInsets.only(
                        left: 20,
                        top: 20,
                        right: 20,
                        bottom: MediaQuery.of(context).viewInsets.bottom + 20,
                      ),
                      child: const TextField(autofocus: true),
                    );
                  },
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}

@danielRi
Copy link

This issue still exists for me with Safari on iOS, with Flutter 3.22.3.

On mobile Chrome on Android it works fine.

@wilsonborba
Copy link

@danielRi can you show more information, and explain the behavior?

This issue still exists for me with Safari on iOS, with Flutter 3.22.3.

On mobile Chrome on Android it works fine.

@danielRi
Copy link

danielRi commented Jul 23, 2024

@asda10 sure!

I have a TextField, like shown below. In iOS Safari, when I navigate to the part where the TextField is renedered (build function executed), I get a blinking cursor in the TextField, but the keyboard does not open, which I expected.

TextField(
              controller: textController,
              autofocus: true,
              onChanged: (_) {},
              onSubmitted: (_) {},
              enabled: true,
              decoration: InputDecoration(
                border: InputBorder.none,
                focusedBorder: InputBorder.none,
                enabledBorder: InputBorder.none,
                errorBorder: InputBorder.none,
                disabledBorder: InputBorder.none,
                hintText: LocaleKeys.prompt_search.tr(),
                hintStyle: const TextStyle(color: AppConstants.grey158),
                prefixIcon: const Icon(
                  Icons.search,
                  color: AppConstants.grey178,
                ),
              ),
              style: const TextStyle(
                color: AppConstants.textColor,
              ),
            )
Flutter Doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.3, on macOS 14.5 23F79 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 15.4)
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.89.1)
[✓] Connected device (4 available)
[✓] Network resources

@RoarGronmo
Copy link

Similar problem. This is in web. Mostly the Chrome browser (as of version 127.0.6533.120 in writing) works ok, but may fail occasionally. Edge Browser fails far more often (as of version 127.0.2651.105 in writing).

My textfiled should be the first widget to gain focus to enter a user email and is programmed like this:

                          SizedBox(
                            width: 400,
                            child: TextFormField(
                              autofocus: isEditing,
                              controller: emailTEC,
                              autovalidateMode: AutovalidateMode.onUserInteraction,
                              onFieldSubmitted: (!((_country!=null)&&(EmailValidator.validate(emailTEC.text)==true)&&(isWaiting==false)))?null:(text)async{
                                setState(() {
                                  isWaiting = true;
                                });
                                await authRequestLogIn(mailAd: emailTEC.text, ctryNo: countryCodeMap[_country]??0);

                                login5025Token = await globals.mPortalDatabase.getLoginToken5025().getSingleOrNull();

                                if(login5025Token!=null){
                                  setState(() {
                                    isWaiting = false;
                                    isEditing = false;
                                    //is5025Login = true;
                                  });
                                } else {
                                  if(context.mounted) Message.error(AppLocalizations.of(context).loginPageLoginNotGranted);
                                }
                              },
                              onChanged: (value){
                                setState(() {
                                  isEditing = true;
                                });
                              },
                              validator: (value) => EmailValidator.validate(value??"")?null:AppLocalizations.of(context).loginPageEnterValidEmail,
                              maxLines: 1,
                              decoration: InputDecoration(
                                  helperText: isEditing?(EmailValidator.validate(emailTEC.text)?(_country!=null?AppLocalizations.of(context).loginPageYouCanNowSubmitYourRequest:AppLocalizations.of(context).loginPagePleaseSelectYourCountryBelow):AppLocalizations.of(context).loginPageEnterYourEmailAbove):"",
                                  helperStyle: TextStyle(color:EmailValidator.validate(emailTEC.text??"")?(_country!=null?Colors.green[800]:Colors.amber):Colors.white),
                                  border: const OutlineInputBorder(),
                                  hintText: "[email protected]",
                                  labelStyle: TextStyle(
                                      background: Paint()
                                        ..color = Colors.white
                                        ..strokeWidth = 15
                                        ..strokeJoin = StrokeJoin.round
                                        ..strokeCap = StrokeCap.round
                                        ..style = PaintingStyle.stroke
                                  ),
                                  label: Text(AppLocalizations.of(context).loginPageLoginEmail),
                                  fillColor: Colors.white,
                                  filled: true
                              ),
                            ),
                          ),

isEditing above is true first time this widget is called upon.

Asked the question to Gemini, she had heard of the problem:

image
image

Soo... we arent't alone...

@jownatan
Copy link

jownatan commented Sep 21, 2024

Still same problem on 2024, on Iphone 13, strange bc it works normal on Iphone XS

 Widget EmailAccountCreation() {
    return Padding(
      padding: EdgeInsets.only(
        left: 16.0,
        right: 16.0,
        bottom: MediaQuery.of(context).viewInsets.bottom + 16.0,
      ),
      child: Center(
        child: Container(
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 16.0),
            child: Form(
              key: _formKey,
              child: SingleChildScrollView(
                child: Column(
                  children: [
                    SizedBox(
                      height: 25.0.ss.f(0.5),
                    ),
                    GestureDetector(
                      onTap: () {
                        _pageController.animateToPage(_hasAccount ? 0 : 2,
                            duration: Duration(milliseconds: 500),
                            curve: Curves.easeInOut);
                      },
                      child: Padding(
                        padding: const EdgeInsets.symmetric(horizontal: 0.0),
                        child: Row(
                          children: [
                            Icon(Bootstrap.arrow_left,
                                color: ColorPalette.secondary),
                            SizedBox(
                              width: 15.0.ss.f(0.5),
                            ),
                            Text("Voltar",
                                style: TextStyle(color: ColorPalette.text)),
                          ],
                        ),
                      ),
                    ),
                    SizedBox(
                      height: 20.0.ss.f(0.5),
                    ),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 16.0),
                      child: Text(
                        _hasAccount
                            ? 'Entre com uma conta existente.'
                            : 'Crie sua conta gratuitamente.',
                        style: TextStyle(
                          color: ColorPalette.text,
                          fontSize: 70.0.ss.f(0.2),
                          fontWeight: FontWeight.w900,
                          fontFamily: 'circular',
                        ),
                        textAlign: TextAlign.center,
                      ),
                    ),
                    SizedBox(height: 100),
                    Container(
                      width: 300.0.ss.f(0.5),
                      height: 300.0.ss.f(0.5),
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(20.0),
                        color: ColorPalette.text,
                      ),
                      child: Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 16.0, vertical: 8),
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            FTextField.email(
                              keyboardType: TextInputType.emailAddress,
                              autofocus: true, // Try setting autofocus to true
                              controller: emailController,
                              hint: '[email protected]',
                              help: const Text(''),
                              onChange: (value) => setState(() {}),
                              validator: (value) =>
                                  (value?.contains('@') ?? false)
                                      ? null
                                      : 'Introduza um e-mail válido.',
                              style: TextFieldStylesDark.passwordStyle(),
                            ),
                            SizedBox(height: 4),
                            FTextField.password(
                              keyboardType: TextInputType.text,
                              autofocus: true, // Try setting autofocus to true
                              controller: passwordController,
                              hint: '********',
                              help: const Text(''),
                              onChange: (value) => setState(() {}),
                              validator: (value) => 8 <= (value?.length ?? 0)
                                  ? null
                                  : 'A senha deve ter pelo menos 8 caracteres.',
                              style: TextFieldStylesDark.passwordStyle(),
                            ),
                            SizedBox(height: 4),
                            Row(
                              children: [
                                FCheckbox(
                                  style: FCheckboxStyle(
                                    enabledStyle: FCheckboxStateStyle(
                                        borderColor: ColorPalette.accent,
                                        iconColor: ColorPalette.peach,
                                        checkedBackgroundColor:
                                            ColorPalette.accent,
                                        uncheckedBackgroundColor:
                                            Colors.transparent),
                                    disabledStyle: FCheckboxStateStyle(
                                        borderColor: ColorPalette.accent,
                                        iconColor: Colors.transparent,
                                        checkedBackgroundColor:
                                            ColorPalette.accent,
                                        uncheckedBackgroundColor:
                                            Colors.transparent),
                                  ),
                                ),
                                SizedBox(width: 7),
                                Text(
                                  'Você concorda com as\nPoliticas de privacidade.',
                                  style: context.theme.typography.sm,
                                ),
                              ],
                            ),
                            SizedBox(height: 30),
                          ],
                        ),
                      ),
                    ),
                    Padding(
                      padding: const EdgeInsets.symmetric(
                          horizontal: 0, vertical: 8),
                      child: Container(
                        width: 300.0.ss.f(0.5),
                        height: 50.0.ss.f(0.5),
                        child: FButton(
                          style: ButtonStyles.primaryButtonStyle,
                          label: const Text('Entrar'),
                          onPress: () async {
                            if (!_formKey.currentState!.validate()) {
                              // Handle errors here.
                              return;
                            }

                            setState(() {
                              _isloadinguser = true;
                            });

                            await _createUserWithEmailPassword(_hasAccount,
                                emailController.text, passwordController.text);
                          },
                        ),
                      ),
                    ),
                    SizedBox(height: 20),
                    GestureDetector(
                      onTap: () {
                        setState(() {
                          _hasAccount = !_hasAccount;
                        });
                        _hasAccount
                            ? _pageController.animateToPage(3,
                                duration: Duration(milliseconds: 1000),
                                curve: Curves.easeInOut)
                            : _pageController.animateToPage(0,
                                duration: Duration(milliseconds: 1000),
                                curve: Curves.easeInOut);
                      },
                      child: Text(
                        _hasAccount
                            ? "Não tem uma conta? clique aqui."
                            : "Já tem uma conta? clique aqui.",
                        style: TextStyle(
                          color: ColorPalette.text,
                          fontSize: 25.0.ss.f(0.2),
                          fontWeight: FontWeight.w700,
                          fontFamily: 'circular',
                        ),
                        textAlign: TextAlign.center,
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }

@hrithikmtorana
Copy link

Testing on iPhone X iOS 16.7.10 produces the same issue, I tried it

Deleting autofocus: true and setting the focus after a delay worked for me - link

This does not work for me on iOS 16.7.10, iPhone X.

Untitled_Project_V1.mp4

@huycozy
Copy link
Member

huycozy commented Oct 28, 2024

I can observe this issue on Android Chrome browser as well (Realme 6, Android 11 and Pixel 7, Android 14) on Flutter stable 3.24.4.

@huycozy huycozy added the browser: chrome-android only manifests in Chrome on Android label Oct 28, 2024
@blingkonnerth

This comment has been minimized.

@ardeshir-33033

This comment has been minimized.

@npateras

This comment has been minimized.

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 browser: chrome-android only manifests in Chrome on Android browser: safari-ios only manifests in Safari on iOS customer: crowd Affects or could affect many people, though not necessarily a specific customer. f: focus Focus traversal, gaining or losing focus found in release: 3.19 Found to occur in 3.19 found in release: 3.20 Found to occur in 3.20 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P3 Issues that are less important to the Flutter project platform-web Web applications specifically team-web Owned by Web platform team triaged-web Triaged by Web platform team workaround available There is a workaround available to overcome the issue
Projects
None yet
Development

No branches or pull requests