Repository navigation
Single Tap on TextField does not display Toolbar #48434
Description
Activity
Hi @Schoonology
can you please provide yourflutter doctor -v?
Thank you- addedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Jan 9, 2020 Sure.
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G95, locale en-US) • Flutter version 1.12.13+hotfix.5 at /Users/schoon/Code/community/flutter • Framework revision 27321ebbad (4 weeks ago), 2019-12-10 18:15:01 -0800 • Engine revision 2994f7e1e6 • Dart version 2.7.0 [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/schoon/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3, Build version 11C29 • CocoaPods version 1.8.3 [✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 40.2.2 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) [✓] VS Code (version 1.41.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.7.1 [✓] Connected device (1 available) • iPhone 8 • 4EE78652-B1E5-4F6E-9671-95CB1F995FC3 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator) • No issues found!- removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Jan 9, 2020 - addeda: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
on Jan 9, 2020 CC @justinmc
I do not quite understand the issue. The current implementation that show toolbars upon long press and double tap. Single tap does not bring up toolbar. If you are looking for reacting to single tap, does this work for you? https://api.flutter.dev/flutter/material/TextField/onTap.html
Native iOS textfields do appear to (somewhat unreliably) show the text selection toolbar when an already-focused text field is tapped. If that's what iOS users expect we should probably implement it; we haven't done so yet though.
Reacted by Sam Moore, Miguel Santirso, Raymond Chan, Lucas Aschenbach, Tsovinar Vardanyan and VictorI tried checking which gestures show the selection menu on each platform (on physical devices). A ✅ means that it shows the menu, and a ❌ means it does not show. In all cases, I had something copied to the clipboard and the field was empty.
Gesture iOS Flutter on iOS Android Flutter on Android tap ✅ ❌ ❌ ❌ double tap ✅ ✅ ❌ ✅ long press ✅ ✅ ✅ ✅ It seems like Flutter should match each platform's behavior (regardless of whether TextField or CupertinoTextField is used). @Schoonology would that solve your problem?
Reacted by LongCatIsLooong, VuiTv, Daniil Kostin, Kenta Murai, Hyung Tae Carapeto Figur, DP, Raymond Chan, arshak, RyosukeOK, Vince Kruger and 5 more@justinmc It seems like that will completely solve my technical problem.
I'm happy to move this conversation somewhere else, but I'd like to use this as an opportunity to start contributing to Flutter. (I've done this with other platforms, but am not set up to do so here.) What does that require? Is this a good issue to start with?
Reacted by Vince Varga@Schoonology That's great! This is not a bad issue to start with, and I'm happy to help.
Start by looking at the contributor guide, especially "setting up your framework development evironment".
The part of the source code that you'll want to start looking at is the calls to showToolbar in text_selection.dart (example). Notice that TextSelection is also overridden in material/text_selection.dart and cupertino/text_selection.dart.
Feel free to reach out to me if you need any pointers. I'm usually online on the Flutter discord channel (https://discordapp.com/invite/BS8KZyg) and I think my email is in my Github profile.
Reacted by Vince Varga and Raymond Chan23 remaining items
Any updates on this?
We are in the middle of refactoring so that we can handle things like this using the Actions system. It should make this much cleaner and less prone to errors.
It could be awhile until that is done, though. If anyone wants to write an interim fix in the meantime feel free.
Is there any sort of workaround to get a single tap to bring up the toolbar on iOS? Using
CupertinoTextFielddoesn't seem to work.My app's primary UI flow involves pasting text into a field. It's in beta, and multiple testers have already reported that they can't paste by tapping on the field. I'm worried about releasing to production when the primary interaction feels wrong on iOS.
Any thoughts on how I can work around this until the real fix is possible?
(cc @justinmc)No workaround that I'm aware of, unfortunately. I'm open to reviewing a PR for this if anyone vitally needs this without waiting for the refactor. We're making progress on the refactor but it's a big change.
Reacted by Bryson Thill and Bruno D'Luka@justinmc
Can we haveonToolbarOptionChangecallback? This will help us To detect the changes of the toolbar option.
Imagine that we have custom autocomplete, and we want to disappear our overlay when the toolbar has been opened.
This is what exactly we need in our app.On my Android (Samsung S21) device the toolbar is shown after a single tap on native apps when the text field is already focused.
Is there any sort of workaround to get a single tap to bring up the toolbar on iOS? Using
CupertinoTextFielddoesn't seem to work.My app's primary UI flow involves pasting text into a field. It's in beta, and multiple testers have already reported that they can't paste by tapping on the field. I'm worried about releasing to production when the primary interaction feels wrong on iOS.
Any thoughts on how I can work around this until the real fix is possible? (cc @justinmc)
Did you end up finding a fix for this?
This was fixed by #111995.
- addedr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
on Oct 25, 2022 Please help me, maybe I'm doing something wrong.
I switched to the master channel to test opening a toolbar with a single tap, but it didn't work for me both on Android and iOS. The toolbar still only opens with a double tap or long press.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.- locked as resolved and limited conversation to collaborators
on Nov 18, 2022
Internal: b/173627308
During final review of an app in the process of being launched, we found a surprising issue: If I, the developer, want to paste into a TextField, I long-press the field, and the toolbar appears. If the producer wants to paste into a TextField, they tap the already-focused Field...and nothing happens.
On every other app we could find, that tap presents the toolbar. As far as I can see from the documentation, Flutter's code, pub.dev, StackOverflow, and Google, there is no current issue tracking this behaviour, method providing this behaviour, or explanation of how to do so.
What I'm looking for is the ability to react to a tap on an already-focused TextField, and present the toolbar (e.g. "Paste", "Select All").