Open Mr-Pepe opened 3 weeks ago
Thanks for the report @Mr-Pepe
Although I don't have Pixel device, but I tried on Pixel emulator with which I didn't observe the reported behavior. I also tried on Samsung S10 with same result. Can you provide a short video of the behavior ?
@darshankawar Here you go :)
https://github.com/flutter/flutter/assets/26527091/4480d94b-dcf7-40ad-b1fc-d87239cc4839
Thanks for the video. Can you provide Gboard details if possible and just to make sure, this doesn't occur with default virtual keyboard correct ?
I just tried with Microsoft SwiftKey and that doesn't have the issue.
The Gboard version is 14.1.04.621126403. Let me know if there is more that I can do.
I've also been experiencing this exact same issue, and would love a fix whenever possible.
Reproducible using the code sample and steps outlined above.
Tested on my Pixel 7.
https://github.com/flutter/flutter/assets/88313112/ee21e40a-685e-4fbd-bc7a-c5e5856cc418
I can reproduce this on my physical Pixel 6, though only when I cause the "Change keyboard" dialog to appear and make a selection, not when I just tap the globe 🌐 key to immediately switch languages.
I've confirmed that this is not coming from the framework. The framework does not send TextInput.hide when I reproduce the bug.
I see the engine calls hideSoftInputFromWindow in two places, maybe one of those are causing it to close: https://github.com/flutter/engine/blob/8eba63f29b8b26931496807cb4fc2fed8e4e3258/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java#L371, https://github.com/flutter/engine/blob/8eba63f29b8b26931496807cb4fc2fed8e4e3258/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java#L401.
And here's an old issue that sounds vaguely similar: https://github.com/flutter/flutter/issues/34169.
Maybe someone with more Android expertise would have a hunch @reidbaker ?
Edit: Oh and I see this in my console when I reproduce it:
I/ImeTracker(15092): com.example.sandbox:eb0c645b: onRequestHide at ORIGIN_CLIENT_HIDE_SOFT_INPUT reason HIDE_SOFT_INPUT_BY_INSETS_API
This does not happen if the app is run as a web app. No idea if that's relevant.
Steps to reproduce
On a Pixel 8 with Gboard:
Expected results
The text field stays focused and the keyboard stays visible, so I can keep typing.
This is the behavior of all other apps on my phone.
Actual results
The text field loses focus and the keyboard disappears.
Code sample
Code sample
```dart import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( home: MyHomePage(), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key}); @override StateScreenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
```console Restarted application in 1,419ms. I/ImeTracker( 9336): com.example.bug:9cc5ecb3: onRequestShow at ORIGIN_CLIENT_SHOW_SOFT_INPUT reason SHOW_SOFT_INPUT D/InputMethodManager( 9336): showSoftInput() view=io.flutter.embedding.android.FlutterView{779c5cb VFED..... .F...... 0,0-1080,2337 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT I/ImeTracker( 9336): com.example.bug:6aff8d06: onRequestShow at ORIGIN_CLIENT_SHOW_SOFT_INPUT reason SHOW_SOFT_INPUT D/InputMethodManager( 9336): showSoftInput() view=io.flutter.embedding.android.FlutterView{779c5cb VFED..... .F...... 0,0-1080,2337 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT I/AssistStructure( 9336): Flattened final assist data: 388 bytes, containing 1 windows, 3 views D/InputConnectionAdaptor( 9336): The input method toggled cursor monitoring on 2 D/InsetsController( 9336): show(ime(), fromIme=true) I/ImeTracker( 9336): com.example.bug:6aff8d06: onCancelled at PHASE_CLIENT_APPLY_ANIMATION I/ImeTracker( 9336): com.example.bug:9cc5ecb3: onShown W/WindowOnBackDispatcher( 9336): sendCancelIfRunning: isInProgress=falsecallback=ImeCallback=ImeOnBackInvokedCallback@21818024 Callback=android.window.IOnBackInvokedCallback$Stub$Proxy@3ac00d1 D/InputConnectionAdaptor( 9336): The input method toggled cursor monitoring off D/InputConnectionAdaptor( 9336): The input method toggled cursor monitoring on D/InputConnectionAdaptor( 9336): The input method toggled cursor monitoring off W/WindowOnBackDispatcher( 9336): sendCancelIfRunning: isInProgress=falsecallback=ImeCallback=ImeOnBackInvokedCallback@21818024 Callback=android.window.IOnBackInvokedCallback$Stub$Proxy@3ac00d1 I/ImeTracker( 9336): com.example.bug:7eab1e62: onRequestHide at ORIGIN_CLIENT_HIDE_SOFT_INPUT reason HIDE_SOFT_INPUT_BY_INSETS_API I/ImeTracker( 9336): uid(10377):bb927647: onHidden ```Flutter Doctor output
Doctor output
```console [✓] Flutter (Channel stable, 3.19.6, on Arch Linux 6.8.9-arch1-1, locale en_US.UTF-8) • Flutter version 3.19.6 on channel stable at /home/felipe/snap/flutter/common/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (3 weeks ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /home/felipe/Android/Sdk/ • Platform android-34, build-tools 34.0.0 • Java binary at: /home/felipe/Applications/android-studio/jbr/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Chrome - develop for the web • CHROME_EXECUTABLE = chromium [✓] Linux toolchain - develop for Linux desktop • clang version 10.0.0-4ubuntu1 • cmake version 3.16.3 • ninja version 1.10.0 • pkg-config version 0.29.1 [✓] Android Studio (version 2022.2) • Android Studio at /home/felipe/Applications/android-studio • 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 17.0.6+0-17.0.6b802.4-9586694) [✓] Connected device (3 available) • Pixel 8 (mobile) • 3A101FDJH00722 • android-arm64 • Android 14 (API 34) • Linux (desktop) • linux • linux-x64 • Arch Linux 6.8.9-arch1-1 • Chrome (web) • chrome • web-javascript • Chromium 124.0.6367.118 Arch Linux [✓] Network resources • All expected network resources are available. • No issues found! ```