Skip to content

Single Tap on TextField does not display Toolbar #48434

Description

@Schoonology

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".

Activity

  1. iapicca commented on Jan 9, 2020

    @iapicca

    Hi @Schoonology
    can you please provide your flutter doctor -v ?
    Thank you

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 9, 2020
  3. Schoonology commented on Jan 9, 2020

    @Schoonology
    Author

    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!
    
  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 9, 2020
  5. added
    a: text inputEntering text in a text field or keyboard related problems
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jan 9, 2020
  6. HansMuller commented on Jan 9, 2020

    @HansMuller
    Contributor
  7. chunhtai commented on Jan 9, 2020

    @chunhtai
    Contributor

    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

  8. HansMuller commented on Jan 9, 2020

    @HansMuller
    Contributor

    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

  9. justinmc commented on Jan 10, 2020

    @justinmc
    Contributor

    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.

    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?

  10. Schoonology commented on Jan 10, 2020

    @Schoonology
    Author

    @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?

  11. justinmc commented on Jan 13, 2020

    @justinmc
    Contributor

    @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.

  12. 23 remaining items

  13. bdlukaa commented on Nov 10, 2021

    @bdlukaa

    Any updates on this?

  14. justinmc commented on Nov 10, 2021

    @justinmc
    Contributor

    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.

  15. doppio commented on Dec 14, 2021

    @doppio

    Is there any sort of workaround to get a single tap to bring up the toolbar on iOS? Using CupertinoTextField doesn'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)

  16. justinmc commented on Dec 15, 2021

    @justinmc
    Contributor

    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.

  17. doppio commented on Dec 22, 2021

    @doppio

    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! 🤞

  18. payam-zahedi commented on May 8, 2022

    @payam-zahedi
    Contributor

    @justinmc
    Can we have onToolbarOptionChange callback? 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.

  19. andaas4 commented on Jun 8, 2022

    @andaas4

    On my Android (Samsung S21) device the toolbar is shown after a single tap on native apps when the text field is already focused.

  20. 0n9aldrin commented on Jul 31, 2022

    @0n9aldrin

    Is there any sort of workaround to get a single tap to bring up the toolbar on iOS? Using CupertinoTextField doesn'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?

  21. Renzo-Olivares commented on Oct 24, 2022

    @Renzo-Olivares
    Contributor

    This was fixed by #111995.

  22. added
    r: fixedIssue is closed as already fixed in a newer version
    on Oct 25, 2022
  23. DmytroMeleshko commented on Nov 4, 2022

    @DmytroMeleshko

    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.

  24. github-actions commented on Nov 18, 2022

    @github-actions

    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 -v and a minimal reproduction of the issue.

  25. locked as resolved and limited conversation to collaborators on Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: fidelityMatching the OEM platforms bettera: text inputEntering text in a text field or keyboard related problemscustomer: money (g3)customer: peppermintfound in release: 1.20Found to occur in 1.20frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cupertino_uicupertino_ui package in flutter/packagesp: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions