Open hhkk opened 1 year ago
this issue can also manifest with shorter text blocks say 100-300 char's
and also when there is no induced TextField scroll, given small font and larger maxLines
Thanks for the report @hhkk Looks like your issue is closely related / similar to https://github.com/flutter/flutter/issues/120604 ? Can you check and confirm ?
It is probably a related issue but not the same. that one focused on end of line tap. this issue concerns tapping almost anywhere.
So with the version here i still get the fail unfortunately :( Flutter 3.10.0-2.0.pre.30 • channel master • Built using flutter build web --release Run on pixel 7
Problem happens easily ...
Test program is below (from the dev cookbook https://docs.flutter.dev/cookbook/forms/focus
lorem ipsum test data is above in comments. Probably don't need 1500 char's of test data.
This is a blocking issue for me and others. Any help so much appreciated.
@hhkk So I tried the same as you mentioned above and observed that upon trying to tap on the given text, it takes me to the end of the line as shown below:
I scrolled all the way up in the textfield and tried to tap, but it took me to the end of the text everytime. Also, while trying to tap in the middle of the text, instead of showing the cursor, it shows me highlighted text which I think is already reported in one of the linked / related issues.
Are you seeing the same behavior as I see from the video ? If not, a short video of the behavior would be helpful.
Good, so you see issues as well. I will verify and get back with more test results, but on a two minute review, the issues you describe are at least similar if not overlapping to mine.
Are these issues you described something slated for fix soon? They make the text field unusable for me.
If not slated for fix soon, do you know if the issues are limited to longer text strings (eg a particular string length)?
I will get back to you with more complete test. Let me know how else I can help.
Thank you
Further testing confirms: I see no issues separate from what you mention. (However where you show blocks for highlighted region, I show mostly underlines. If I press enough times/erratically enough, only then do I see block rather than underline. Images herein show both underline only, and block/underline together.
Do you expect these issues to be resolved any time soon? Alternative approach to use in the meantime?
If you know the issue # that you suspect replaces this one, please include here. I read several related issues but I don't think I saw quite the issue - or at least as clearly as you described it - occurring.
https://github.com/flutter/flutter/issues/120604 refers to persian text and clicking at the end. Whereas this item is for any text and clicking anywhere - perhaps requiring a multiline text of longer length such as > 100 or > 300 char's. So I"m not certain it's the same issue.
Thank you
FYI - here is a list of all related issues i have found
search key: https://github.com/flutter/flutter/issues?q=is%3Aissue+tap+cursor+textfield
https://github.com/flutter/flutter/issues/124483 this
https://github.com/flutter/flutter/issues/98720 [Android] TextField cursor doesn't move to tapped position, but converts into text selection mode after selecting input mode from virtual keyboard. #98720
https://github.com/flutter/flutter/issues/100004 two exclamation points
https://github.com/flutter/flutter/issues/121164 feb 21 2023 Text field cursor position in RTL goes to the penultimate character
https://github.com/flutter/flutter/issues/122443 mar 10 2023 Failed assertion when trying to set caret position to text position that is not visible
https://github.com/flutter/flutter/issues/118566 jan 16 2023 Text field cursor position in RTL goes to the penultimate character
https://github.com/flutter/flutter/issues/114433 not 2022 TextField's cursor cannot move in the middle of the word
https://github.com/flutter/flutter/issues/120604 feb 13 TextField cursor stands in a wrong position while using persian words
https://github.com/flutter/flutter/issues/109175 aug 2022 cursor is not inserting value at the specific position where i tapped when readOnly mode is enabled in textformField
https://github.com/flutter/flutter/issues/100004 mar 2022 tap to move cursor in textfield not working on android
As I've reviewed and thought about the above list of issues and this one, this problem is not addressed in prior issues in my opinion.
the iphone version demonstrating this is iPhone 12 Pro Max iOS Version 16.3.1
Thanks for the update. Based on the report and my findings earlier, I am going ahead and keeping this issue open.
OK thanks.
clicking in various places around the text field may reveal other oddities, but probably all included in existing items.
this is a key issue IMO - can't edit means can't use :)
This sounds similar to https://github.com/flutter/flutter/issues/122394. @hhkk do you think it would be reasonable to merge this issue into that one?
HI @yjbanov - I don't see reference to 1) tapping the pointer 2) on a cell phone and 3) having the cursor end up in a seemingly unrelated place (the bottom). So I do not think they are the same issue. Let me know if I am missing something. Thanks
FYI, I have a fix for this issue on Android. I will post more details tomorrow (it is late here) and also tried a similar fix on iOS.
FYI, I have a fix for this issue on Android. I will post more details tomorrow (it is late here) and also tried a similar fix on iOS.
Sweet! Please test with clicking around various places in a longish (eg ~1500 char lorem ipsum) text block and see if you see any other similar anomalies in terms if tap location vs resulting cursor location. (I'm not convinced that it's always "wrongly going to the end of the text block".)
Thank you Henry
@hhkk Thanks for the detailed report. @darshankawar Thanks for verifying this.
I filed https://github.com/flutter/engine/pull/41202 with a simplified code sample. From my testing, the fix is ok on Android/Chrome, but I have to find why it partially works on iOS/Safari.
I'm not convinced that it's always "wrongly going to the end of the text block".)
From my investigation, the cursor does not always jump to the end. It seems to jump to a place which was visible before (for instance, if we scroll and then tap, the cursor will jump to the text which was at the tap position before the scroll). As described in the PR, it is because both Flutter and the
This solution worked for me with Android and Windows
controller.addListener(() {
if (controller != null) {
if (controller.selection ==
TextSelection.fromPosition(
TextPosition(
offset: controller.text.length - 1,
),
)) {
controller.selection = TextSelection.fromPosition(
TextPosition(
offset: controller.text.length,
),
);
}
}
});
I also have the same issue. See the below video from Android Chrome browser: https://user-images.githubusercontent.com/14223997/233150374-97b1d784-fb9c-4a45-a908-5eb2040e1fee.mp4
Sorry - I'm somewhat new at this. How and when would I be able to see a fix in a flutter upgrade?
Or is there a faster way to incorporate a fix from this? https://github.com/flutter/engine/pull/41202
Thank you
The Android PR is merged. Unassigned myself and update the title because I have no solution for the moment to fix this on iOS.
The Android PR is merged. Unassigned myself and update the title because I have no solution for the moment to fix this on iOS.
Thank you Bruno! At least in the current Beta channel, I no longer see the issue of being unable to place the cursor properly in a multiline textfield on my Android Pixel 7 which has version:
And this issue ALSO SEEMS TO BE FIXED iOS ipad version 15.7.3 on an ipad air 2
Question: Is my observation of a fix having happened (in regards to inability to tap/place the cursor in a textfield) consistent with changes you have made?
Thank you for these fixes if so!
Henry (middle name Bruno ;)
And this issue ALSO SEEMS TO BE FIXED iOS ipad version 15.7.3 on an ipad air 2 Question: Is my observation of a fix having happened (in regards to inability to tap/place the cursor in a textfield) consistent with changes you have made?
@hhkk Did you check this using the Flutter Web build of your app or the Android/iOS builds?
I'm asking because my fix is only for Flutter Web on Chrome/Android, so the issue should be still reproducible on Safari/iOS. And as far as I know, this fix does not reach current the beta channel yet.
Agreed. Yes I did see the issue continue on iOS. So I agree the issue appears to be resolved for Android but continues for iOS.
I am only using Flutter Web Chrome.
And I guess the flutter channel matters i.e that beta has the fixed while Master may not?
I can get you details on the version of iOS that failed, if you're interested.
Thank you Henry
On Tue, May 9, 2023, 1:01 PM Bruno Leroux @.***> wrote:
And this issue ALSO SEEMS TO BE FIXED iOS ipad version 15.7.3 on an ipad air 2 Question: Is my observation of a fix having happened (in regards to inability to tap/place the cursor in a textfield) consistent with changes you have made?
@hhkk https://github.com/hhkk Did you check this using the Flutter Web build of your app or the Android/iOS builds?
I'm asking because my fix is only for Flutter Web on Chrome/Android, so the issue should be still reproducible on Safari/iOS. And as far as I know, this fix does not reach current the beta channel yet.
— Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/124483#issuecomment-1540542738, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF34OCBYDOOTHCK74W5A6LXFJZ6ZANCNFSM6AAAAAAWYILTEE . You are receiving this because you were mentioned.Message ID: @.***>
And I guess the flutter channel matters i.e that beta has the fixed while Master may not?
In general all changes will appear in the master/main channel first, then beta and then stable. So any very recent fix will be in master but not in beta, and later it will be in master and beta but not stable.
The reverse (fixed in beta but not in master) would be unusual, though, and if you see something like that it should definitely be reported as a bug. If something's broken in master, then that breakage will probably reach beta and stable in the future unless someone fixes it first.
More here: https://github.com/flutter/flutter/wiki/Flutter-build-release-channels
It would be great if someone could give us a summary of where we are on this issue for iOS. Flutter is basically unusable as far as I can tell on iOS with regards to this multi-line text field cursor position issue.
On Thu, Jun 29, 2023, 6:35 AM Jimmy Forrester-Fellowes < @.***> wrote:
I am experiencing this issue too clicking & selecting on TextFields although I've just noticed the issue is only on my external display, when I drag the web browser window to my macbooks internal display, there is no issue.
Could it be a DPI calculation issue?
— Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/124483#issuecomment-1612835209, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF34OEGN2FUH25JE3NSCF3XNVLATANCNFSM6AAAAAAWYILTEE . You are receiving this because you were mentioned.Message ID: @.***>
Second request. It's been 4 months since this major issue was reported regarding iOS (iphone) text fields and cursor positioning via tap.
Can anyone please comment whether this issue is being worked on? My test yesterday was with latest master flutter channel and is still failing grossly for cursor positioning within a multiline textfield on iphone. Works well for android AFAIK.
It's been 4 months since I reported this issue. This makes flutter unusable on apple devices!!
Can you please let us know how to think about this issue broadly?
Thank you Henry
hey @hhkk, this issue being worked on as part of a larger fix here https://github.com/flutter/flutter/issues/120613. I'll take some time this week to investigate and see if there's a potential workaround we can implement before then.
Well actually I should update my findings because I realize now there's a long press of a text field which leads to a magnifying glass pop-up and for that mechanism the cursor placement works perfectly. Someone else I know tried and taps and drags of the finger also work perfectly in addition to the magnifier. So we have two different results at this point but at least there's a working mechanism for placing the cursor reliably on iOS and Android. So definitely seeing some progress here. I'll see if I can figure out why one of our iPhones behave well and the other less so.
Thank you!
On Thu, Aug 17, 2023, 10:37 AM Hassan @.***> wrote:
hey @hhkk https://github.com/hhkk, this issue being worked on as part of a larger fix here #120613 https://github.com/flutter/flutter/issues/120613. I'll take some time this week to investigate and see if there's a potential workaround we can implement before then.
— Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/124483#issuecomment-1682403516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF34OE4B7Y2ZOLS2F2HWBDXVYUDRANCNFSM6AAAAAAWYILTEE . You are receiving this because you were mentioned.Message ID: @.***>
correction: on further testing, we see that the magnifier is good but it can be also be difficult with the magnifier to place cursor in the exact location reliably.
@hhkk Thank you for the notes! So currently selection placement in iOS only works reliably with the magnifier (long press + drag)?
I'm on the current beta version and the magnifier seems like the only mostly reliable way to place a cursor on an iphone. I say MOSTLY reliable because it still can feel clunky with the magnifier in some situations.
It seems like placing the cursor in the bottom portion of the text field is more trouble some than the top.
We have tested an iPhone SE and an iPhone 12 both on iOS.
Android seems better.
I am using default. Renderer. Is default renderer good for multi-line purposes?
If it would be helpful, I can try to be more systematic in my testing and give you some information about results.
Thank you Henry
On Fri, Aug 18, 2023, 11:13 AM Hassan @.***> wrote:
@hhkk https://github.com/hhkk Thank you for the notes! So currently selection placement in iOS only works reliably with the magnifier (long press + drag)?
— Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/124483#issuecomment-1684063989, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF34OGOEVBNQCINV5CW4YTXV6BBDANCNFSM6AAAAAAWYILTEE . You are receiving this because you were mentioned.Message ID: @.***>
This issue is assigned to @htoor3 but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
Keep in mind - one can't edit text if you can't place the cursor at least very nearby an intended location on tap.
As run in chrome and safari browsers on android and ios cell phones, after many experiments including a simple flutter dev cookbook case we ask...
seen in flutter version 3.2.2 stable and 3.7.10 stable on 3 people's environments.
issue is also seen using http-server against release flutter build web (build/web) content.
To demonstrate:
Open this url on a cell phone https://docs.flutter.dev/cookbook/forms/focus
1 in the cookbook dev code editor add: maxLines: 5
2 click run
3 in the textfield, paste the ~1500 char's "lorem ipsum" text below.
4 tap various places within the text (once the on screen keyboard settles) and
5 !!!!!! issue: you will see cursor does not end up where the tap occurred. bounces to other places, with underlines and confused attempts at hi-lighting I guess
6 this is just one environment to demo this issue in. I've tried many different tests. (I'd be happy to see even one TextField example where this does not occur, on a cell phone.)
sample text to paste:
END SAMPLE TEXT
also we tried many cell phone textfield examples using
flutter run -d web-server --web-port $1 --web-hostname 0.0.0.0
FLUTTER DOCTOR