Repository: flutter
Issue: TextField scrolling jumps around when dragging text selection handle upwards
Labels: a: text input,framework,f: material design,f: scrolling,has reproducible steps,P2,f: selection,found in release: 3.10,team-design,triaged-design,found in release: 3.13

### 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. Run code
2. Long press a word near the bottom of the text field to select it (and then **end** the long-press)
3. Tap the selection handle at the start of the highlighted word, and drag it upwards

### Expected results

The text field should scroll smoothly (as it does if you do **not** end the long-press at the end of step 2. but simply drag finger upwards immediately)

### Actual results

The scrolling jumps around -- see video here https://github.com/flutter/flutter/assets/25343797/750293cb-3256-49c3-aa62-6eace882f486 ('Screenshots or video' section isn't showing up for some reason)

### Code sample

<details><summary>Code sample</summary>

```dart
import 'dart:io';

import 'package:flutter/cupertino.dart';
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 StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final TextEditingController _textEditingController = TextEditingController(
      text:
          "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Neque sodales ut etiam sit amet nisl. Molestie nunc non blandit massa enim nec dui. Ornare quam viverra orci sagittis eu volutpat odio. In vitae turpis massa sed elementum tempus. Laoreet non curabitur gravida arcu ac tortor dignissim. In cursus turpis massa tincidunt dui ut ornare lectus sit. Enim praesent elementum facilisis leo vel fringilla est. Volutpat diam ut venenatis tellus in. Ut sem viverra aliquet eget sit amet. Dictum at tempor commodo ullamcorper a. Aliquam nulla facilisi cras fermentum odio eu feugiat. Tristique et egestas quis ipsum suspendisse ultrices. Elementum sagittis vitae et leo duis ut. Aliquet risus feugiat in ante. Pretium fusce id velit ut tortor pretium viverra. Dictumst quisque sagittis purus sit amet volutpat consequat mauris nunc. Turpis tincidunt id aliquet risus feugiat in ante metus dictum. Viverra aliquet eget sit amet tellus cras adipiscing. Nisl tincidunt eget nullam non nisi est sit.\nVelit aliquet sagittis id consectetur. Elementum curabitur vitae nunc sed velit. Ante in nibh mauris cursus mattis molestie. Vel elit scelerisque mauris pellentesque. Commodo sed egestas egestas fringilla phasellus faucibus. Rutrum tellus pellentesque eu tincidunt tortor. Nec ullamcorper sit amet risus nullam eget felis eget nunc. At urna condimentum mattis pellentesque. Mi sit amet mauris commodo quis imperdiet. Iaculis eu non diam phasellus vestibulum lorem. Tempus iaculis urna id volutpat lacus laoreet non curabitur. Venenatis lectus magna fringilla urna porttitor rhoncus dolor purus non. At tempor commodo ullamcorper a. Nisl vel pretium lectus quam id leo in vitae. Mauris rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar pellentesque. Ultrices eros in cursus turpis massa. Et tortor consequat id porta nibh venenatis cras sed felis. Amet luctus venenatis lectus magna fringilla urna porttitor. Est sit amet facilisis magna etiam. Lacus vestibulum sed arcu non odio euismod lacinia.\nAmet consectetur adipiscing elit pellentesque habitant morbi tristique senectus. Commodo nulla facilisi nullam vehicula ipsum a arcu cursus. Pretium lectus quam id leo in vitae turpis massa. Proin nibh nisl condimentum id. Dui nunc mattis enim ut tellus elementum. Libero enim sed faucibus turpis in eu mi bibendum. Eu tincidunt tortor aliquam nulla facilisi cras fermentum odio eu. Porttitor eget dolor morbi non. Nulla facilisi cras fermentum odio eu feugiat pretium nibh ipsum. Cum sociis natoque penatibus et magnis. Metus dictum at tempor commodo ullamcorper a. Convallis tellus id interdum velit laoreet id. Mi in nulla posuere sollicitudin aliquam ultrices sagittis orci.\nLacinia quis vel eros donec ac odio tempor orci. Risus nec feugiat in fermentum. Convallis convallis tellus id interdum. Eget velit aliquet sagittis id consectetur purus ut faucibus. Fringilla est ullamcorper eget nulla. Commodo ullamcorper a lacus vestibulum sed arcu non. Nulla aliquet enim tortor at. Malesuada proin libero nunc consequat interdum varius sit amet. Faucibus ornare suspendisse sed nisi lacus. Pharetra et ultrices neque ornare aenean euismod. Et malesuada fames ac turpis egestas maecenas pharetra convallis. Urna molestie at elementum eu facilisis. Morbi tristique senectus et netus et malesuada fames ac. Diam quis enim lobortis scelerisque fermentum dui faucibus in. Luctus accumsan tortor posuere ac ut consequat semper viverra nam. Justo laoreet sit amet cursus sit. Morbi blandit cursus risus at ultrices. Sem fringilla ut morbi tincidunt augue interdum velit. Ultricies leo integer malesuada nunc vel risus commodo viverra. Orci sagittis eu volutpat odio facilisis mauris.\nElit sed vulputate mi sit amet mauris. Risus nullam eget felis eget nunc lobortis mattis aliquam. Consectetur a erat nam at lectus urna. Tincidunt dui ut ornare lectus sit amet est. Neque aliquam vestibulum morbi blandit. Maecenas sed enim ut sem viverra aliquet eget. In massa tempor nec feugiat nisl pretium. Donec adipiscing tristique risus nec feugiat in fermentum posuere. Elit at imperdiet dui accumsan sit amet nulla facilisi morbi. Feugiat vivamus at augue eget. Quam id leo in vitae turpis. Nibh tellus molestie nunc non. Ipsum dolor sit amet consectetur adipiscing. Sit amet consectetur adipiscing elit ut aliquam purus sit.");

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: TextField(
        controller: _textEditingController,
        selectionControls: Platform.isIOS ? CupertinoTextSelectionControls() : MaterialTextSelectionControls(),
        autofocus: true,
        textCapitalization: TextCapitalization.sentences,
        maxLines: null,
      ),
    );
  }
}
```

</details>




### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

https://github.com/flutter/flutter/assets/25343797/750293cb-3256-49c3-aa62-6eace882f486

</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel master, 3.13.0-17.0.pre.77, on macOS 13.3.1 22E772610a darwin-arm64, locale en-GB)
    • Flutter version 3.13.0-17.0.pre.77 on channel master at /opt/homebrew/Caskroom/flutter/3.0.0/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7de053b2b8 (4 hours ago), 2023-08-07 03:51:33 -0400
    • Engine revision eb91441398
    • Dart version 3.2.0 (build 3.2.0-41.0.dev)
    • DevTools version 2.26.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/joshminton/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio 2.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/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 11.0.13+0-b1751.21-8125866)

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio 2.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 11.0.15+0-b2043.56-8887301)

[✓] Connected device (3 available)
    • Pixel 7 (mobile) • 2B171FDH2008K5 • android-arm64  • Android 13 (API 33)
    • macOS (desktop)  • macos          • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)     • chrome         • web-javascript • Google Chrome 115.0.5790.114

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>