Repository: flutter
Issue: Android: keyboard opens when focusing on button while moving with "tab"
Labels: a: text input,platform-android,engine,f: focus,has reproducible steps,P2,customer: chalk (g3),team-android,triaged-android,found in release: 3.13,found in release: 3.16

Internal: b/371244390

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Open a page that contains a textfield
2. Use "tab" to jump to the textfield which will focus it and open up the keyboard
3. Press "tab" again, this will move the focus to the next element below the textfield -> Keyboard will be closed
4. Press "tab" again, this will move the focus to the next element which is also a button
5. Keyboard will pop up again, even though it shouldn't
6. Close the page and move around the initial page -> Keyboard will pop up again

(if you jump out of the textfield using tab and then use the arrow keys to move to the next widget (an not tab) this issue is not happening)

### Expected results

The keyboard should only open when the user focuses a textfield

### Actual results

The keyboard opens when focusing the a button.


### Code sample

<details><summary>Code sample</summary>

```dart
void main() {
  runApp(MaterialApp(home: _TestPage()));
}


class _TestPage extends StatelessWidget {
  const _TestPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            TextButton(
              onPressed: () {
                Navigator.of(context).push(MaterialPageRoute(builder: (context) {
                  return _Textfieldpage();
                }));
              },
              child: Text("Open page with textfield"),
            ),
            IconButton(
              icon: Icon(Icons.add),
              onPressed: () {},
            ),
          ],
        ),
      ),
    );
  }
}

class _Textfieldpage extends StatefulWidget {
  const _Textfieldpage({super.key});

  @override
  State<_Textfieldpage> createState() => _TextfieldpageState();
}

class _TextfieldpageState extends State<_Textfieldpage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(24),
        child: Column(
          children: [
            TextField(),
            IconButton(
              icon: Icon(Icons.add),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
            IconButton(
              icon: Icon(Icons.access_alarm),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
            IconButton(
              icon: Icon(Icons.access_alarm),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        ),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>


https://github.com/flutter/flutter/assets/36447137/43e1918a-f393-4d01-a4c9-10c39af6893d


At the end of the video I am using the arrow keys instead of tab to navigate between the widgets. As described previously, this will not trigger the keyboard opening up.

</details>


### Logs

No Logs where printed.

### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[!] Flutter (Channel stable, 3.13.1, on macOS 13.6 22G120 darwin-arm64, locale en-DE)
    • Flutter version 3.13.1 on channel stable at /Users/user/fvm/versions/3.13.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e1e47221e8 (8 weeks ago), 2023-08-22 21:43:18 -0700
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0
    • 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 33.0.2)
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Users/user/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/user/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/user/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.10121639/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Community Edition (version 2023.2)
    • IntelliJ at /Users/user/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/232.8660.185/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Community Edition (version 2023.1.3)
    • IntelliJ at /Users/user/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/231.9161.38/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.82.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.72.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 13 (API 33) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 13.6 22G120 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 118.0.5993.70
    ! Error: Browsing on the local area network for iPhone von User. 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
    • All expected network resources are available.

! Doctor found issues in 1 category.

```

</details>