Repository navigation
Incorrect cursor position in RTL TextField when moving between letters #110416
Copy link
Copy link
Closed
Labels
a: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusfound in release: 3.0Found to occur in 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Hello everyone, I am facing a problem with the TextField and the TextFormField widget when I set the app language to an RTL language.
In specific, When I try to write in the text field The cursor I set to the right not to the left, as you can see in the attached image, also when I leave the field and try to enter the field again I can't reach the first letter instead it starts from the letter before it, as it's shown in the image.
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.856], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.17)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.70.2)
[√] Connected device (5 available)
[√] HTTP Host Availability
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.856], locale en-US)
• Flutter version 3.0.5 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (6 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\maich\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.17)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.32630.194
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.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 11.0.12+7-b1504.28-7817840)
[√] VS Code (version 1.70.2)
• VS Code at C:\Users\maich\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.46.0
[√] Connected device (5 available)
• SM M115F (mobile) • R9JN70PQW2J • android-arm • Android 12 (API 31)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.856]
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.102
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.54
[√] HTTP Host Availability
• All required HTTP hosts are available
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusfound in release: 3.0Found to occur in 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version

Activity
huycozy commentedon Aug 29, 2022
Hi @MaichelSameh, thanks for filing the issue.
This issue is reproducible on the latest
stableandmasterchannels.On iOS, when trying to focus again the TextField, the behavior looks fine, but when using Spacebar to move the cursor, the issue has happened.
✅: No Issue ❌: Issue reproduced
Demo
android.mp4
ios.mp4
Sample code
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.2.1 21D62 darwin-x64, locale en-VN) • Flutter version 3.0.5 at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (9 hours ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-33, build-tools 31.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.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.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2020.3.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • 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 [✓] IntelliJ IDEA Community Edition (version 2022.1.1) • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app • 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 [✓] VS Code (version 1.69.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0 [✓] Connected device (3 available) • SM T225 (mobile) • R9JT3004VRJ • android-arm64 • Android 11 (API 30) • macOS (desktop) • macos • darwin-x64 • macOS 12.2.1 21D62 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found![✓] Flutter (Channel master, 3.1.0-0.0.pre.2552, on macOS 12.5 21G72 darwin-x64, locale en-EE) • Flutter version 3.1.0-0.0.pre.2552 on channel master at /Users/huynq/Documents/GitHub/flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision f66a097919 (2 hours ago), 2022-08-28 20:20:36 -0400 • Engine revision 4e36ebc1f3 • Dart version 2.19.0 (build 2.19.0-146.0.dev) • DevTools version 2.16.0 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-33, build-tools 31.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13E113 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.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.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2020.3.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • 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 [✓] IntelliJ IDEA Community Edition (version 2022.1.1) • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app • 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 [✓] VS Code (version 1.70.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.46.0 [✓] Connected device (3 available) • iPhone 13 (mobile) • 2526BC1A-435D-4B08-B99C-44B928F2517B • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 12.5 21G72 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.101 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found!farhadsaberi commentedon Oct 9, 2022
I have the same problem in RTL languages in flutter text fields on android devices.
M144-Coder commentedon Nov 3, 2022
Any updates on this issue or any workaround for it?
asashour commentedon Nov 20, 2022
Skia issue created at https://bugs.chromium.org/p/skia/issues/detail?id=13894
kiaxseventh commentedon Nov 21, 2022
I am tired of this problem
Every once in a while, it reappears in the new version of Flutter
Please fix it once and forever
5 remaining items
HasanAlqaisi commentedon Jan 10, 2023
I have the same issue on android, any updates?
abdullahalamodi commentedon Jan 12, 2023
I have the same problem, it's very annoying :(
huycozy commentedon Jan 12, 2023
/cc @jason-simmons for thoughts.
abdullahalamodi commentedon Jan 12, 2023
you don't need setState()
MaichelSameh commentedon Jan 12, 2023
You are right, thanks for your help ^_^
[-]Flutter TextField rtl issue[/-][+]Incorrect cursor position in RTL TextField when moving between letters[/+]M144-Coder commentedon Apr 1, 2023
I have just tested on the latest flutter master channel (3.9.0-20.0.pre.75) and this issue was resolved, it looks like solving issue #122480 resolved this problem.
On the other hand the problem still occurs on the latest stable channel (3.7.9).
Any idea when #122480 will land on the stable channel?
RomanIvn commentedon Apr 3, 2023
#122480 (comment)
Are you sure? just tested and keyboard is still in reverse + cursor is in the wrong position when selecting a word in a multiline text field
M144-Coder commentedon Apr 3, 2023
@RomanIvn I didn't test on a multiline text, I have just tested a normal text field in RTL here is my code sample:
M144-Coder commentedon May 24, 2023
This issue was resolved on flutter stable release 3.10. I suggest closing this issue.
huycozy commentedon May 26, 2023
@M144-Coder Thanks for your confirmation. This issue seems to have been fixed on the latest master channel as I also cannot reproduce it there.
Demo
Record_2023-05-26-17-37-17.mp4
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!I'll close this issue as fixed on the latest channels. If you still experience this issue, kindly leave a comment below and I will reopen this. Thank you!
github-actions commentedon Jun 9, 2023
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
flutter doctor -vand a minimal reproduction of the issue.