flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
164.28k stars 27.11k forks source link

Windows desktop app completely losing keyboard focus #151457

Open RemarkIt opened 1 month ago

RemarkIt commented 1 month ago

Steps to reproduce

Rarely it happens with windows desktop app, that the application completely stops being responsive to any hardware keyboard input. I managed to discover only one scenario where the issue can be reliably reproduced.

  1. create a new project, e.g. flutter create test_app --platforms windows
  2. add a new TextField widget
  3. build and run
  4. press Win+D to minimize all apps
  5. press Win + D to regain focus
  6. try writting into the TextField

Expected results

Input appears in the TextField

Actual results

No input appears. Also the windows alert beeping sound is triggered. Note, that the app is not responsive to the keyboard at all (e.g. Tab behavior)

Code sample

Code sample ```dart [Paste your code here] ```

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console [√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.19045.4598], locale en-US) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.5.4) [√] VS Code, 64-bit edition (version 1.87.2) [√] VS Code (version 1.92.0-insider) [√] Connected device (3 available) [√] Network resources • No issues found! PS C:\Users\admin\source\repos\test_app> flutter doctor -v [√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.19045.4598], locale en-US) • Flutter version 3.22.2 on channel stable at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (5 weeks ago), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3 [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.5.4) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Enterprise • Visual Studio Enterprise 2022 version 17.5.33530.505 • Windows 10 SDK version 10.0.22000.0 [√] VS Code, 64-bit edition (version 1.87.2) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.88.0 [√] VS Code (version 1.92.0-insider) • VS Code at C:\Users\admin\AppData\Local\Programs\Microsoft VS Code Insiders • Flutter extension version 3.92.0 [√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4598] • Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.142 • Edge (web) • edge • web-javascript • Microsoft Edge 126.0.2592.87 [√] Network resources • All expected network resources are available. • No issues found! ```
huycozy commented 1 month ago

Thank you for the report. I also can reproduce this issue on my end.

Demo video https://github.com/flutter/flutter/assets/104349824/0f65dbb5-09bc-4066-b0f6-5d5fb20e84eb
flutter doctor -v (stable & master) ```bash [√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.19045.4412], locale en-US) • Flutter version 3.22.2 on channel stable at C:\WIP\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (11 days ago), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3 [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\AndroidSDK • Platform android-34, build-tools 34.0.0 • Java binary at: C:\Program Files\Android\Android Studio Hedgehog\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4) • Visual Studio at D:\DOWNLOADWORK\VS2022 • Visual Studio Community 2022 version 17.4.33213.308 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2022.3) • Android Studio at C:\Program Files\Android\Android StudioGiraffe • 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-b2043.56-10027231) [√] Android Studio (version 2023.1) • Android Studio at C:\Program Files\Android\Android Studio Hedgehog • 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.7+0-b2043.56-10550314) [√] VS Code (version 1.89.1) • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.90.0 [√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4412] • Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.141 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.67 [√] Network resources • All expected network resources are available. • No issues found! ``` ```bash [!] Flutter (Channel master, 3.23.0-14.0.pre.118, on Microsoft Windows [Version 10.0.19045.4529], locale en-US) • Flutter version 3.23.0-14.0.pre.118 on channel master at C:\WIP\flutter_master ! Warning: `flutter` on your path resolves to C:\WIP\flutter\bin\flutter, which is not inside your current Flutter SDK checkout at C:\WIP\flutter_master. Consider adding C:\WIP\flutter_master\bin to the front of your path. ! Warning: `dart` on your path resolves to C:\WIP\flutter\bin\dart, which is not inside your current Flutter SDK checkout at C:\WIP\flutter_master. Consider adding C:\WIP\flutter_master\bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision aa179bdc01 (in the future), 2024-07-03 02:34:15 -0400 • Engine revision a02e3f673d • Dart version 3.5.0 (build 3.5.0-323.0.dev) • DevTools version 2.37.0 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\AndroidSDK • Platform android-34, build-tools 34.0.0 • Java binary at: C:\Program Files\Android\Android Studio Hedgehog\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4) • Visual Studio at D:\DOWNLOADWORK\VS2022 • Visual Studio Community 2022 version 17.4.33213.308 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2022.3) • Android Studio at C:\Program Files\Android\Android StudioGiraffe • 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-b2043.56-10027231) [√] Android Studio (version 2023.1) • Android Studio at C:\Program Files\Android\Android Studio Hedgehog • 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.7+0-b2043.56-10550314) [√] VS Code (version 1.90.1) • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.90.0 [√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.4529] • Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.127 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.67 [√] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```
cbracken commented 1 month ago

/cc @dkwingsmt