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
163.05k stars 26.82k forks source link

Desktop: Entire text is not selected while tabbing between textfields #150339

Open KaushikGupta007 opened 1 week ago

KaushikGupta007 commented 1 week ago

Steps to reproduce

  1. Create two Text Fields on Home page
  2. Run app on windows
  3. Write text in first and second field
  4. Click on first field
  5. Press Tab key on keyboard to move to second field
  6. Text is not selected in second field

Expected results

Text in Field should be selected when moving to next field

Actual results

Text in Text Field in not selected

Code sample

Code sample ```dart Future main() async { runApp(MaterialApp( initialRoute: "/", routes: { "/": (context) => const Home(), }, )); } class Home extends StatefulWidget { const Home({super.key}); @override State createState() => _HomeState(); } class _HomeState extends State { @override Widget build(BuildContext context) { return Scaffold( body: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ TextFormField( decoration: const InputDecoration(hintText: "First Field", labelText: "First Field") ), const SizedBox(height: 8,), TextFormField( decoration: const InputDecoration(hintText: "Second Field", labelText: "Second Field") ) ], ), ), ); } } ```

Screenshots or Video

Screenshots / Video demonstration **Expected Result in Flutter Web** https://github.com/flutter/flutter/assets/129219828/f8107e40-09f0-4984-864e-b2bdd7e5c092 **Actual Result in Flutter Windows** https://github.com/flutter/flutter/assets/129219828/2f71dd06-5517-4108-ab3a-52725596298d

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.22621.3593], locale en-IN) • Flutter version 3.22.2 on channel stable at C:\Users\Admin\fvm\versions\3.22.2 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (12 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 33.0.1) • Android SDK at C:\Users\Admin\AppData\Local\Android\sdk • Platform android-34, build-tools 33.0.1 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.1) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.9.34616.47 • Windows 10 SDK version 10.0.22621.0 [√] Android Studio (version 2022.2) • Android Studio at C:\Program Files\Android\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-b2043.56-9586694) [√] 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 (5 available) • CPH2467 (mobile) • 1a715d74 • android-arm64 • Android 14 (API 34) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.3593] • Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.61 • Edge (web) • edge • web-javascript • Microsoft Edge 125.0.2535.85 [√] Network resources • All expected network resources are available. • No issues found! ```
darshankawar commented 1 week ago

Thanks for the report. This doesn't seem to be specific to windows, as, on macOS too, I was able to replicate the reported behavior. The entire text gets selected on web when tabbing back and forth, but in desktop platform, the text isn't selected and tabbing back and forth changes the cursor which is located at the end of the text.

I found this old issue which was fixed but most probably was for web : https://github.com/flutter/flutter/issues/78895 Another maybe related open issue: https://github.com/flutter/flutter/issues/59519

stable, master flutter doctor -v ``` [!] Flutter (Channel stable, 3.22.2, on macOS 12.2.1 21D62 darwin-x64, locale en-GB) • Flutter version 3.22.2 on channel stable at /Users/dhs/documents/fluttersdk/flutter ! Warning: `flutter` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (33 hours ago), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [!] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer ! Flutter recommends a minimum Xcode version of 13. Download the latest version or update via the Mac App Store. • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] VS Code (version 1.62.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (5 available) • SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 11 (API 30) • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios • iOS 14.4.1 18D61 • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category. [!] Flutter (Channel master, 3.23.0-13.0.pre.242, on macOS 12.2.1 21D62 darwin-x64, locale en-GB) • Flutter version 3.23.0-13.0.pre.242 on channel master at /Users/dhs/documents/fluttersdk/flutter ! Warning: `flutter` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5187cab7bd (2 days ago), 2024-06-14 23:35:34 -0400 • Engine revision 9779c273aa • Dart version 3.5.0 (build 3.5.0-266.0.dev) • DevTools version 2.36.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. [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/dhs/Library/Android/sdk ✗ cmdline-tools component is missing Run `path/to/sdkmanager --install "cmdline-tools;latest"` See https://developer.android.com/studio/command-line for more details. ✗ Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13C100 • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2) • IntelliJ at /Applications/IntelliJ IDEA.app • Flutter plugin version 65.1.4 • Dart plugin version 213.7228 [✓] VS Code (version 1.62.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.29.0 [✓] Connected device (3 available) • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios • iOS 15.3.1 19D52 • macOS (desktop) • macos • darwin-x64 • macOS 12.2.1 21D62 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. [!] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer ! Flutter recommends a minimum Xcode version of 13. Download the latest version or update via the Mac App Store. • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] VS Code (version 1.62.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (5 available) • SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 11 (API 30) • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios • iOS 14.4.1 18D61 • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category. ```
justinmc commented 1 week ago

We should probably confirm what the native behavior is on Windows, Linux, and MacOS. If anyone knows for certain and has tried it on any of these platforms (not in a web browser), please confirm whether text gets selected or not when tabbing. I think Flutter's current behavior is to preserve the selection.

@darshankawar Did you try this on a native Mac app or just on a Flutter Mac app?

Native Windows Native Mac Native Linux
Selects all
darshankawar commented 5 days ago

@darshankawar Did you try this on a native Mac app or just on a Flutter Mac app?

@justinmc Hi, I tried now using Reminders app on Mac and it seem to select the entire text upon tabbing:

https://github.com/flutter/flutter/assets/67046386/0943d0c3-81fe-4c1c-8c0f-d7af53219c59

gnprice commented 5 days ago

For Linux, I tried just now in the GNOME Settings application, and its behavior was to select the whole text. So that's probably the normal behavior for GNOME-based applications, at least.