-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
[WEB] TextField actions are not triggered on Android #89384
Comments
Hi @franarolas, I verifief this on the latest stable channel on Xiomi Android k20 pro and I am not able to reproduce the issue. I see that Screen.Recording.2021-09-03.at.11.55.54.AM.movWhat device are you facing this issue on? flutter doctor -v
|
Hello, if i try this code running with When I don't write on the TextField it works, but if i write and then submit it don't work Im trying this in Realme X3 PRO my flutter doctor: ! Doctor found issues in 1 category. ` |
@maheshmnj I really think that this issue is related to android system and not to the device, as my testing team reported this issue and they tryed it with different Android devices, also I tried it with a Redmi note 9 and a Poco x3 pro. Whatever as @Fito989 said, you have to write some text first, it "works"(The keyboard action doesn't change) if you don't enter text but it doesn't if the textfield has some text in it. |
@franarolas thanks for the details, I can reproduce the issue on the latest stable and the master channel, The issue only occurs in Android and works fine on IOS. The Output
flutter doctor -v
[✓] Flutter (Channel master, 2.6.0-1.0.pre.103, on macOS 11.5.2 20G95 darwin-arm,
locale en-GB)
• Flutter version 2.6.0-1.0.pre.103 at /Users/mahesh/Documents/flutter_master
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2c30b252a5 (6 days ago), 2021-08-27 23:26:03 -0400
• Engine revision ca52647cd2
• Dart version 2.15.0 (build 2.15.0-65.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/mahesh/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/mahesh/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.5.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.10.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.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 11.0.8+10-b944.6916264)
[✓] VS Code (version 1.59.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.26.0
[✓] Connected device (4 available)
• Redmi K20 Pro (mobile) • d9dac45d •
android-arm64 • Android 11 (API 30)
• iPhone 12 Pro (mobile) • B622CBB7-F906-4FA7-8F49-FACEAAC905AB • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos •
darwin-arm64 • macOS 11.5.2 20G95 darwin-arm
• Chrome (web) • chrome •
web-javascript • Google Chrome 93.0.4577.63
• No issues found!
✅ : No Issue ❌: Issue reproduced |
@maheshmnj I think that this should be marked as P3, how is it possible that one of main widgets of the Flutter framework is failing like that on the stable version? Are we really the first people to encounter this issue? I can't imagine the amount of webs in production having this problem without noticing, there should be a hotfix for that. |
@franarolas Please read this https://github.com/flutter/flutter/wiki/Issue-hygiene for understanding how the issues are prioritized. |
My bad, then it should be P3. |
I'll just mention the one thing I discovered that has not been mentioned yet is that if you append a trailing space to the text you are trying to enter, then the text string is submitted. Also, I will add that you don't need |
I have traced the issue down one level to The gist includes debug output from RawKeyboardListener in the Console. The data from RawKeyboardListener is quite rich on Chrome on a desktop computer, but on Chrome on Android it is very poor. I am diving deeper down into the problem now. |
Another new observation: There is something special about the ASCII symbols '!' through '@' (33 - 64, 0x21 - 0x40), which are all of the characters between the space (32, 0x20) and the uppercase letter 'A' (65, 0x41). If you put any number of spaces followed by one of those symbols in between two strings (like "first" and "second"), then the input works properly. Example: "first @second" will work. Additional weird observation: If you put three or more spaces between any two strings, the input works properly. If there are just one or two spaces between the strings, and the second string starts with a character with an ASCII code higher than 64, then it does not. |
The other non-character ASCII symbols behave the same as those from '!' to '@'. Those symbols are: [ \ ] ^ _ ` { | } ~ A period is also special: "first.second" works, but "first,second" does not. |
Does the fact that the keyboard has a different enter key have anything to do with this issue? Note that the "key" in the bottom-right of the Flutter app is a return ↩️ , whereas the key in the bottom-right of the w3c keyboard listener is a right arrow ➡️ that inputs "Enter" (ASCII 13, which is also called "Carriage Return"). I do not yet know how to To get the Flutter app return ↩️ key, don't set |
I was able to determine that the 0x0 "submitBtn" input field is responsible for eating all of the enter/return key events. By changing the type from "submit" to "text" in the generated
So, initially the controller reports that there is no text in the editable text widget ("┤├"). We then tap the "1" key, we get a You can see for yourself at https://www.redquark.com/flutterBug3/#/ |
Well, I have a potential (*) fix for the problem. Remove (*) I only say "potential" because I don't know if this is going to mess up anything else. It 100% fixes the problem of not being able to enter text that does not end in a space or contain any of those intervening combinations of spaces and symbols. I am thinking that perhaps the return |
As far as what events are generated in the browser, the two keys behave the same (a series of |
@RedQuark thanks for the detailed analysis! We actually only use After you remove |
@mdebbar Thanks for the additional information! I have only had the opportunity to test |
@mdebbar I was on the precipice of submitting the pull request for removing I tested this solution of adding the On Android Chrome, the The alternatives are not much better. Oh, and in case you were wondering, using the Given the limited and unsatisfactory options above, I would opt for the Thank you for your time and assistance. |
That was my first (aborted) attempt at a PR for fixing this issue. The code fix was easy. It's everything else about the PR process that is hard. |
|
@jtmcdole I am currently working on a solution which lets you pick which key you want to use for Enter, including |
Having the same issue. Added a space after the text do the job, but it's not a good way to solve the problem x') |
I apologize for not being able to set aside adequate time to finish submitting a PR for this issue yet. I have not forgotten it. In the meantime though, I can't help but think what we are proposing for Flutter is not a fix of a Flutter problem, but rather a workaround for an Android and/or GBoard and/or Chrome on Android problem. That is unless someone can propose a reason that "string" and "string " should not have the same behavior for any given combination of So does anyone have any insight as to where in the Android/GBoard/Chrome on Android ecosystem the problem really lies, and if so, has anyone submitted a bug report to the appropriate project(s)? |
I suspect it's not truly an Android/GBoard problem, or else we'd see this issue in non-Flutter contexts as well. Other people may have seen it out there, but I haven't seen this issue while trying to research/debug it in any context but Flutter. I'm not certain (still chasing things down looking for a workaround), but I think it's a bug in the This means that the action isn't even getting to the widget to try to be handled. I think it's part of why I'm not even able to get the "enter" press from a FocusNode (either the root one or for the specific TextField widget). |
Where exactly is it that you're removing inputmode = "text" from, I can't seem to find it in the TextField or EditableText class. I'd like to implement this solution if possible. |
I have come up with a work around for this, but it is unfortunately super in the weeds and only works on web, my solution is to use an HtmlElementView and just wrap my own main.dart
|
@dvalles The file is
This is the code: /// Single-line text input type. @OverRide Change |
Facing the same issue, for mobile web on Android... |
prior to flutter/flutter#89384, text would not get inserted when completing on android web.
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 |
I'm encountering a really strange issue as I haven't seen anyone reporting it and I think that it should be a P1 issue.
I've tested it in iOS through web server, it works properly, also I did built the app in Android and everything works fine, whatever it seems that it is not working with Android in Flutter web.
Steps to Reproduce
Expected results:
The onFieldSubmitted action is not triggered when there is text in the TextField(Same result with TextFormField).
Actual results:
Nothing is triggered.
Flutter doctor
The text was updated successfully, but these errors were encountered: