New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display text input toolbar on single tap for iOS #95644
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! Sorry this code is so convoluted before the refactor. I think you must have noticed from the previous failures, small changes to this code can have a lot of unintended consequences on other gestures and platforms. I think you've almost got it working though.
There was still one failure, but maybe it was a flake. I re-ran it.
Hrm, there's still a failure, but I don't think it's related to the changes here. Looks like there's some kind of permissions issue when running the check. 🤷♂️ |
Looked like an infrastructure problem to me (not related to this PR). I just re-ran it. If it doesn't turn green, can you try merging master into this branch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@doppio Can you look at my comment about the return value in the test? Otherwise I think this is ready to merge. Sorry I forgot to check back in on this PR for awhile when it went green.
@justinmc You're right, that doesn't seem to serve any purpose anymore. I don't recall why that got added 😅. Removed! |
@justinmc I think these check failures are more infrastructure flakiness -- they show as canceled. Should they be run again? |
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
@doppio The failures did look unrelated. I've rerun them and hopefully they turn green. I think there is a bug with this PR though. If you tap in a way that will move the cursor, then on native iOS the toolbar doesn't show, but it does when using this PR: Screen.Recording.2022-02-24.at.1.20.12.PM.mov |
Ahh, you're right @justinmc. After digging into it, I remember why I originally did it this way: #95644 (comment). Revising it re-introduced incorrect behavior. I've made a revision to immediately update |
Can you rebase with master to update your branch? That should resolve the failing checks. |
9b188a4
to
343221d
Compare
I rebased with master, but the checks are still failing. I'm not sure what's going on with these check failures now as they were passing before. |
Failure is:
|
…itable text on some platforms
…vide a context menu.
… of selectWordEdge
… of waiting for next frame
70e7ed0
to
6a1ae31
Compare
@justinmc Any chance this could get another look? Apologies that it took me so long to get around to fixing up this PR. |
We hope so since this is key feature on ios textfield. Users use only single tap to show toolbar, app without that feature is just considered buggy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@doppio +1 to what @Renzo-Olivares said about editableText.textEditingValue. Also can you update this PR with master? There is a merge conflict.
Otherwise I think this looks good!
# Conflicts: # packages/flutter/lib/src/widgets/text_selection.dart
…tingValue.selection` to avoid changing `renderEditable`
I've made the suggested changes but it looks like some tests are now failing due to other changes to this system since I originally made the PR, and I'm struggling to fix them. To be honest, I think I'm in over my head at this point and I don't really have the time to keep revisiting this every few months. I'm closing this but anyone is welcome to take my changes if they contribute to a working solution. |
@doppio No worries and thanks for sticking with this for so long! This is really tricky to fix, hence why we're trying to refactor this in the long run. I'll see if I can work out a solution in the same vein in the meantime. |
@justinmc we at Presence are adopting a native wrapper. Our code is closed but you can access a public version here https://github.com/collinjackson/flutter-native-text-input I might be wrong, but I think flutter should change its mind about text input and wrapper native textfield for both android and ios. |
It also seems like that a lot of tests are failing due to that change. As example tests which check that the toolbar doesn't show on a simple tap. It would require a bit more work then just the current changes in this PR. |
@iosephmagno I fielded a similar question recently here: #106703 (comment) I'm keeping one eye on packages like flutter-native-text-input in case our current approach ends up clearly falling behind though. |
@justinmc actually the list of iOS flutter input issues is long. We started to think about wrapping native input because of #28894. Emojis size is very small in both text and textfield and that is a deal breaker for a premium chat app in flutter. But then we also have come across with the other issues that you guys are dealing with such as #48434, #12920, #106703 and a few others. Henry’s version of flutter native input textfield is not the best one. The guy stopped to be active on the plugin and we improved it a lot. We and some friends, added support for custom font, flutter-like onTap feature and fixed several bugs. If you guys want to give it a try, write to me and I will provide a link to the most updated repo. The rationale is:
|
This PR changes the behavior of single-tapping an in-focus editable text field on iOS, such that the selection toolbar is toggled if the user's text selection was not changed. The intent is for Flutter (iOS) text fields to mimic the behavior of native input toolbars on iOS. Note that this PR does not attempt to fix other platform inconsistencies with the text selection toolbar.
The primary change removes the
hideToolbar
call from the Material/Cupertino-specific implementations ofTextField
. Instead, the toolbar hide/show logic is performed inTextSelectionGestureDectorBuilder.onSingleTapUp
based on the current platform.This is an attempt to address a personal urgent need for correct input toolbar behavior on iOS, but it sounds like this change would be affected/overwritten by @justinmc's refactor mentioned here.
Fixes #48434
Pre-launch Checklist
///
).