flutter / flutter/flutter

iOS autocorrect highlight persists in field after hot restart

Open
#150,815 4 comments 1 reaction 0 assignees View on GitHub
P2 platform-ios team-text-input triaged-text-input
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

1. Run any app with a text input, such as the one below.
2. Enter some text until autocorrect is triggered and the text is highlighted blue. If you can't trigger it, try a commonly misspelled word.
3. Hot restart.

### Expected results

The text is cleared and so is the highlight.

### Actual results

The text disappears, but the highlight remains. It happens for both TextField and CupertinoTextField, but only on iOS (I tried iOS simulator, Android emulator, and MacOS).

### Code sample

Code sample

```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(
primarySwatch: Colors.blue,
),
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(
appBar: AppBar(
title: Text(title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.0),
child: TextField(),
),
],
),
),
);
}
}
```

### Screenshots or Video

Screenshot 2024-06-25 at 5 24 09 PM

### Flutter Doctor output

Doctor output

```console
[!] Flutter (Channel master, 3.23.0-13.0.pre.335, on macOS 14.5 23F79 darwin-arm64, locale en)
! Unknown upstream repository.
Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[!] Android Studio (version unknown)
✗ Unable to determine Android Studio version.
[✓] Android Studio (version 2023.2)
[✓] Connected device (3 available)
! Error: Browsing on the local area network for Bella’s iPad. 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

! Doctor found issues in 2 categories.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.