Repository navigation
Single Tap on TextField does not display Toolbar #48434
Copy link
Copy link
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: fidelityMatching the OEM platforms betterMatching the OEM platforms bettera: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemscustomer: money (g3)customer: peppermintfound in release: 1.20Found to occur in 1.20Found to occur in 1.20frameworkflutter/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 onp: cupertino_uicupertino_ui package in flutter/packagescupertino_ui package in flutter/packagesp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
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").
- Is there a way to do this currently that I missed? (If so, great! It's entirely likely I just failed to find it, and it could even be "obvious".)
- If not, what is the best way to go about adding that? We've decided upon Flutter as our platform of choice, and I'd like to start contributing as we transition from "launch our first app" to "maintain all our apps".
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: fidelityMatching the OEM platforms betterMatching the OEM platforms bettera: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemscustomer: money (g3)customer: peppermintfound in release: 1.20Found to occur in 1.20Found to occur in 1.20frameworkflutter/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 onp: cupertino_uicupertino_ui package in flutter/packagescupertino_ui package in flutter/packagesp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Activity
iapicca commentedon Jan 9, 2020
Hi @Schoonology
can you please provide your
flutter doctor -v?Thank you
Schoonology commentedon Jan 9, 2020
Sure.
HansMuller commentedon Jan 9, 2020
CC @justinmc
chunhtai commentedon Jan 9, 2020
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
HansMuller commentedon Jan 9, 2020
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.
CC @LongCatIsLooong
justinmc commentedon Jan 10, 2020
I 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.
It seems like Flutter should match each platform's behavior (regardless of whether TextField or CupertinoTextField is used). @Schoonology would that solve your problem?
Schoonology commentedon Jan 10, 2020
@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?
justinmc commentedon Jan 13, 2020
@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.
23 remaining items
bdlukaa commentedon Nov 10, 2021
Any updates on this?
justinmc commentedon Nov 10, 2021
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.
doppio commentedon Dec 14, 2021
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)
justinmc commentedon Dec 15, 2021
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.
doppio commentedon Dec 22, 2021
I created a PR for this over at #95644 if you're willing to take a look at some point @justinmc. 🙂 It's my first contribution and I'm not sure if I did it right though! 🤞
payam-zahedi commentedon May 8, 2022
@justinmc
Can we have
onToolbarOptionChangecallback? 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.
andaas4 commentedon Jun 8, 2022
On my Android (Samsung S21) device the toolbar is shown after a single tap on native apps when the text field is already focused.
0n9aldrin commentedon Jul 31, 2022
Did you end up finding a fix for this?
Renzo-Olivares commentedon Oct 24, 2022
This was fixed by #111995.
DmytroMeleshko commentedon Nov 4, 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.
github-actions commentedon Nov 18, 2022
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.