Repository navigation
TextField that embedded in the GestureDetector can't be selected #129161
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowIt was better in the past than it is nowf: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- create a textfield and wrap it into the gesture detector.
Expected results
the textfield can be selected and updated.
Actual results
can't select the text
Code sample
Code sample
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> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
onTap: () {
print('single tap');
},
onDoubleTap: () {
print('double tap');
},
// this textfield can't be selected
child: TextField(
controller: TextEditingController()..text = 'Initial Text',
),
),
// this textfield can be selected
TextField(
controller: TextEditingController()..text = 'Initial Text',
),
],
),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel unknown, 3.10.1, on macOS 13.0 22A5358e darwin-arm64, locale en-CN)
! Flutter version 3.10.1 on channel unknown at /Users/lucas.xu/Desktop/flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
! 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 33.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.79.2)
[✓] Connected device (3 available)
[✓] Network resourcesReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowIt was better in the past than it is nowf: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Activity
huycozy commentedon Jun 20, 2023
Thanks for filing this issue. Checking this across Flutter versions, it appears on the latest stable and master channels but works as expected on Flutter
3.7.12.Per your Flutter version and the latest working version, this may be introduced in 3.10.0 or 3.10.1.
Demo
Screen.Recording.2023-06-20.at.19.14.48.mov
Screen.Recording.2023-06-20.at.19.18.08.mov
flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.0.1 22A400 darwin-x64, locale en-VN) • Flutter version 3.10.5 on channel stable at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 796c8ef792 (29 hours ago), 2023-06-13 15:51:02 -0700 • Engine revision 45f6e00911 • Dart version 3.0.5 • DevTools version 2.23.1 [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-33, build-tools 32.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/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 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • 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 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.79.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.66.0 [✓] Connected device (5 available) • Pixel 3a (mobile) • 964AY0WL20 • android-arm64 • Android 12 (API 32) • iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios • iOS 15.7.2 19H218 • iPhone 14 Pro (mobile) • 98082851-A0C4-4E39-A310-21C48B10A364 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.133 [✓] Network resources • All expected network resources are available. • No issues found!TahaTesser commentedon Jun 20, 2023
This might be a change in behavior. I'll take a closer look tomorrow.mikhael28 commentedon Jun 20, 2023
There is a first time for everything - this was the first time that I've been negatively affected by a new Flutter release. Once every year and a half, I will take those odds :) But yes, apparently wrapping TextFields in a gesture detector will make the form fields innaccessible (unless you long press a field/force touch on a mac trackpad).
Either way, I'm going to have to push out a hotfix for this - I wish I found out about this sooner. Please comment to let us know when this is addressed.
goderbauer commentedon Jun 20, 2023
cc @Renzo-Olivares
bleroux commentedon Jun 21, 2023
I bisected this to #117502 which was a great improvement.
Renzo-Olivares commentedon Jun 21, 2023
@bleroux Thanks for looking into that! I think I know what is happening. We use
currentDownfrom the_TapStatusTrackerMixinwhen we fire the tap down event in the recognizer. The_TapStatusTrackerMixinconsecutive tap timer is timing out while theGestureArenais delaying victory because we haveTapGestureRecognizer,DoubleTapGestureRecognizer, andTapAndDragGestureRecognizerand all of them wait for all recognizers to declare a loss. Even though at the end of this interactionTapAndDragGestureRecognizeris declared victorious,currentDownhas becomenulland no tap down event is fired as a result, so theTextFieldcannot be selected. I'll put a PR out to correct this. The solution may be not to depend oncurrentDownwhen firing a tap down event.`_TapStatusTrackerMixin` should wait until the next `PointerDownEvent…
mikhael28 commentedon Jun 23, 2023
@Renzo-Olivares I'm assuming this will be released in the next weekly hotfix?
github-actions commentedon Jul 7, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.