Repository: flutter
Issue: TextField loses focus when scrolling web app
Labels: a: text input,f: scrolling,platform-web,f: focus,has reproducible steps,P2,found in release: 3.7,found in release: 3.9,team-web,triaged-web

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

When visiting a Flutter web app from an iPad (or any touch device?), TextFields will lose focus when scrolling. That's a problem, because sometimes only the appearance of the keyboard makes the screen scrollable. The disappearance of the keyboard upon scrolling then makes it impossible to scroll TextFields into view.

This only happens for web apps. When I build the same app for the iPad, the TextField keeps its focus when scrolling.

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Execute `flutter run -d chrome` on the code sample <!-- (see "Code sample" section below) -->
2. Visit the web app from an iPad or the iPad simulator
3. Scroll to the input field and focus it to open the keyboard
4. Scroll drag anywhere on the screen to scroll.
5. The text field will lose focus and the keyboard will disappear

**Expected results:** The TextField keeps its focus and the keyboard remains visible.

**Actual results:** The TextField loses focus and the keyboard is dismissed.

<details>
<summary>Code sample</summary>

<!--
      Please create a minimal reproducible sample that shows the problem
      and attach it below between the lines with the backticks.

      To create it you can use `flutter create bug` command and update the `main.dart` file.

      Alternatively, you can use https://dartpad.dev/
      which is capable of creating and running small Flutter apps.

      Without this we will unlikely be able to progress on the issue, and because of that
      we regretfully will have to close it.
-->

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Container(
        padding: const EdgeInsets.symmetric(horizontal: 20),
        height: 9999,
        child: const TextField(),
      ),
    );
  }
}
```

</details>

<details>
<summary>Flutter doctor</summary>

```
[✓] Flutter (Channel stable, 3.7.3, on macOS 12.6 21G115 darwin-arm64, locale en-GB)
    • Flutter version 3.7.3 on channel stable at /Users/johannesstricker/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9944297138 (5 weeks ago), 2023-02-08 15:46:04 -0800
    • Engine revision 248290d6d5
    • Dart version 2.19.2
    • DevTools version 2.20.1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.76.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (3 available)
    • iPad Pro (11-inch) (4th generation) (mobile) • 691C391C-6BC9-49D2-96EB-FACE582E4E2F • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
    • macOS (desktop)                              • macos                                • darwin-arm64   • macOS 12.6 21G115 darwin-arm64
    • Chrome (web)                                 • chrome                               • web-javascript • Google Chrome 111.0.5563.64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
```
</details>