flutter
flutter copied to clipboard
TextFormField TextCapitalization.words not working when text is selected
Is there an existing issue for this?
- [X] I have searched the existing issues
- [X] I have read the guide to filing a bug
Steps to reproduce
On a Flutter app for Android or iOS:
- Create a simple
TextFormField
as followed:
TextFormField(
textCapitalization: TextCapitalization.words,
textInputAction: TextInputAction.done,
),
- Now when you run the app, in the TextFormField, enter the word:
Example
- Now select the last characters of that word, for example:
ample
- Type something, for example:
pect
Expected results
Because I use textCapitalization: TextCapitalization.words
, I expect to type pect
, all in lowercase, because I started typing in the middle of the word.
Actual results
I actually type Pect
, with the first character in uppercase and the virtual keyboard in uppercase mode for that character.
Code sample
Code sample
(Works only on Android / iOS) https://dartpad.dev/?id=e75b493dae1287757c5e1d77a0dc73f1
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.2 22D49 darwin-arm64, locale fr-FR)
• Flutter version 3.10.2 on channel stable at /Users/mregnauld/FlutterSDK/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9cd3d0d9ff (7 days ago), 2023-05-23 20:57:28 -0700
• Engine revision 90fa3ae28f
• Dart version 3.0.2
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
• Android SDK at /Users/mregnauld/AndroidSDK
• Platform android-33, build-tools 33.0.0-rc1
• ANDROID_HOME = /Users/mregnauld/AndroidSDK
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.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 17.0.6+0-17.0.6b802.4-9586694)
[✓] VS Code (version 1.77.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.60.0
[✓] Connected device (3 available)
• iPhone de Matthieu (mobile) • 00008030-001C085222DA802E • ios • iOS 16.2 20C65
• macOS (desktop) • macos • darwin-arm64 • macOS 13.2 22D49 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.126
[✓] Network resources
• All expected network resources are available.
• No issues found!
Hi @mregnauld
I checked this on my Android device but I can type pect
as expected (in lowercase). Which device are you testing on? And what is the keyboard app you are using?
Hello @huycozy I got the problem with an iPhone 11 (iOS 16.2). I also tested on a Samsung device but I don't get the problem, it behaves as expected.
Thanks, I can see the issue on iOS as well.
Android | iOS |
---|---|
✅ | ❌ |
✅: No Issue ❌: Issue reproduced
Demo video
https://github.com/flutter/flutter/assets/104349824/f9f17161-565b-46ad-a317-a18b323bcc4d
Also, I see there's an open issue (#99436) that is somewhat similar to this but the case looks a bit different (switching capitalization on runtime) and that issue is happening on both iOS and Android (I verified on Android as well). So I will label this issue as a separate issue.
flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
• Flutter version 3.10.2 on channel stable at /Users/huynq/Documents/GitHub/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9cd3d0d9ff (22 hours ago), 2023-05-23 20:57:28 -0700
• Engine revision 90fa3ae28f
• Dart version 3.0.2
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 32.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E222b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.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 17.0.6+0-17.0.6b802.4-9586694)
[✓] VS Code (version 1.78.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (3 available)
• RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 11 (API 30)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.126
[✓] Network resources
• All expected network resources are available.
• No issues found!
[!] Flutter (Channel master, 3.11.0-16.0.pre.45, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
• Flutter version 3.11.0-16.0.pre.45 on channel master at /Users/huynq/Documents/GitHub/flutter_master
! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3c61b9d834 (37 minutes ago), 2023-05-31 19:39:15 -0700
• Engine revision f9bc342c84
• Dart version 3.1.0 (build 3.1.0-155.0.dev)
• DevTools version 2.23.1
• 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 32.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 32.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E222b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.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 17.0.6+0-17.0.6b802.4-9586694)
[✓] VS Code (version 1.78.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (5 available)
• RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 11 (API 30)
• iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios • iOS 15.7.2 19H218
• iPhone 14 Pro (mobile) • 98082851-A0C4-4E39-A310-21C48B10A364 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.126
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
Yes, the problem is exactly what you show in the video.
Confirmed that on native iOS, the behavior is as expected, so this is a bug.
CC @LongCatIsLooong from triage.
I still see this issue, anyone else?