-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to reproduce
-
Create a minimal Flutter app containing a single TextField/CupertinoTextField(see code below).
-
Type a few words, then double-tap to place the caret and bring up the selection handles.
-
Quickly drag either selection handle left ↔ right several times.
Expected results
Selection handles should remain visible and track the user’s finger, even during very fast drags—matching native iOS behaviour.
Actual results
While dragging at high speed, the selection handles (and the system-style context menu) vanish unexpectedly.
Text selection is lost until the user lifts their finger and double taps again.
I don´t know if it helps but, the disappearance originates in ServicesBinding._handlePlatformMessage:
// Called when the system dismisses the system context menu, such as when
// the user taps outside the menu…
case 'ContextMenu.onDismissSystemContextMenu':
if (_systemContextMenuClient == null) {
assert(false,
'Platform sent onDismissSystemContextMenu when no SystemContextMenuClient was registered.');
return;
}
_systemContextMenuClient!.handleSystemHide();
_systemContextMenuClient = null;
break;
According to the comment, this callback should fire only when the user taps outside the menu.
However, a fast drag gesture appears to be interpreted as such a tap, triggering handleSystemHide() and clearing _systemContextMenuClient, which in turn hides both the context menu and the selection handles.
Code sample
Code sample
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const CupertinoApp(
home: CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('TextField Selection Issue'),
),
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24),
child: CupertinoTextField(),
),
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
Flutter App:
ScreenRecording_05-11-2025.03-08-30_1.MP4
Native iOS App:
ScreenRecording_05-11-2025.03-09-22_1.MP4
Logs
No response
Flutter Doctor output
Doctor output
Flutter 3.32.0-0.3.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 3bd718ee44 (10 days ago) • 2025-04-30 10:11:08 -0700
Engine • revision 453dd7174c (11 days ago) • 2025-04-29 21:15:41 -0700
Tools • Dart 3.8.0 (build 3.8.0-278.2.beta) • DevTools 2.45.1