You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add awareness for cursor position in selection-related behaviors across desktop platforms #57679
My recollection from working on Gecko macOS text selection many years ago is that desktop platforms have different expected behaviors around how keyboard text selection interacts with existing selections, especially mouse-based. In particular: if you select some text, then shift-left-arrow or shift-right-arrow, what happens? Does it matter if the text was selected from left to right or right to left with the mouse?
We should audit this behavior on each desktop platform in a native text field, then make sure the framework handling matches on each platform.
Related note: @robert-ancell noticed that the base and extent reported by the framework doesn't seem to be different for left-to-right vs right-to-left selection, which may be an issue for getting correct behavior everywhere.
Tl;dr: All native platforms agree on this behavior, but Flutter behaves differently and needs to be updated.
The pivot point is the edge of the selection that remains fixed during the shift/arrow operations before any reversal. Here is an example of each on Mac:
Pivot point left
Pivot point right
For a selection in the middle of the text made with a mouse in the given direction, the behavior is given when holding shift and using the arrow keys.
Flutter
OSX 10.15.7 TextEdit
Windows 10 Home Notepad
Ubuntu 20.04.1 LTS TextEditor
Left to right
Pivot point right
Pivot point right
Pivot point right
Pivot point right
Right to left
Pivot point right
Pivot point left
Pivot point left
Pivot point left
Is there anything else I'm missing that I should try? Otherwise it seems that Flutter just needs to adjust its behavior to match all the other platforms (no need to adjust per-platform).
I confirmed that Flutter's TextSelection has its base set to the lowest point and extent set to the highest, regardless of the direction of the selection. So indeed, TextSelection does not currently have the information we need to change the pivot point unfortunately.
Here is where we are swapping base and extent to be in ascending order in the codebase:
Sorry, this shouldn't have been closed since #71756 only fixes the first problem mentioned (#57679 (comment)) and not the other problems I found in #57679 (comment).
changed the title [-]Audit mouse+keyboard selection behaviors across desktop platforms[/-][+]Add awareness for cursor position in selection-related behaviors across desktop platforms[/+]on Jan 19, 2021
PR #71756 fixed the main problem, but the issue kind of expanded in scope when I went through all of the inconsistencies on all the different platforms in #57679 (comment).
I say let's keep this open until I can match all of the behavior in the table in that comment. Or I can always move that to a separate issue if you think that's better.
@justinmc if we're going to keep this one open rather than open a new bug, it would be useful to update the above table to show which behaviours are working and which still need to be done.
Good call. I've updated the table in #57679 (comment) to match the current behavior. #75032 will fix some of these and I will update the table again when it's merged.
I've updated the table of behaviors at #57679 (comment) now that #75032 has been merged. It looks like it actually fixed a few of them, but there are still some differences that need to be manually tweaked.
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 -v and a minimal reproduction of the issue.
Activity
stuartmorgan-g commentedon May 20, 2020
Related note: @robert-ancell noticed that the base and extent reported by the framework doesn't seem to be different for left-to-right vs right-to-left selection, which may be an issue for getting correct behavior everywhere.
justinmc commentedon Dec 5, 2020
Tl;dr: All native platforms agree on this behavior, but Flutter behaves differently and needs to be updated.
The pivot point is the edge of the selection that remains fixed during the shift/arrow operations before any reversal. Here is an example of each on Mac:
For a selection in the middle of the text made with a mouse in the given direction, the behavior is given when holding shift and using the arrow keys.
Is there anything else I'm missing that I should try? Otherwise it seems that Flutter just needs to adjust its behavior to match all the other platforms (no need to adjust per-platform).
I confirmed that Flutter's TextSelection has its base set to the lowest point and extent set to the highest, regardless of the direction of the selection. So indeed, TextSelection does not currently have the information we need to change the pivot point unfortunately.
Here is where we are swapping base and extent to be in ascending order in the codebase:
flutter/packages/flutter/lib/src/rendering/editable.dart
Lines 1854 to 1857 in b372c52
Edit This is now fixed in #71756.
4 remaining items
justinmc commentedon Dec 14, 2020
Sorry, this shouldn't have been closed since #71756 only fixes the first problem mentioned (#57679 (comment)) and not the other problems I found in #57679 (comment).
kf6gpe commentedon Jan 12, 2021
/cc @csells, who did some of this in Q3.
[-]Audit mouse+keyboard selection behaviors across desktop platforms[/-][+]Add awareness for cursor position in selection-related behaviors across desktop platforms[/+]kf6gpe commentedon Mar 2, 2021
@justinmc We think this may be done --- can you confirm and close if corrrect? Thanks!
justinmc commentedon Mar 3, 2021
PR #71756 fixed the main problem, but the issue kind of expanded in scope when I went through all of the inconsistencies on all the different platforms in #57679 (comment).
I say let's keep this open until I can match all of the behavior in the table in that comment. Or I can always move that to a separate issue if you think that's better.
cbracken commentedon Mar 9, 2021
@justinmc if we're going to keep this one open rather than open a new bug, it would be useful to update the above table to show which behaviours are working and which still need to be done.
justinmc commentedon Mar 10, 2021
Good call. I've updated the table in #57679 (comment) to match the current behavior. #75032 will fix some of these and I will update the table again when it's merged.
justinmc commentedon Mar 18, 2021
I've updated the table of behaviors at #57679 (comment) now that #75032 has been merged. It looks like it actually fixed a few of them, but there are still some differences that need to be manually tweaked.
justinmc commentedon Mar 18, 2021
I've created this issue to track Windows inconsistencies: #78572.
This PR will fix all Mac problems here and will close this issue: #78573.
github-actions commentedon Aug 4, 2021
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.