-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Fix text selection from right to left #24214
Conversation
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thanks for fixing this. I knew I was going to break something when I started allowing reversed base/extent.
Is Flutter Web able to distinguish between selections made left-to-right vs. right-to-left? Or I'm guessing that part is handled by the browser and Flutter doesn't care which direction the selection was made from?
I'm talking about cases like this:
abc|def|g
Then shift + left arrow is pressed. If the selection was made with the mouse left to right then it will look like this:
abc|de|fg
But if it was made right to left then it would be:
ab|cdef|g
|
@justinmc the browser always uses base/extent in order. Even if you select from right to left, the browser doesn't revert base/extent. You can try it here: https://jsfiddle.net/ex736p81/2/ |
|
Ah thanks, you're right! It must be keeping track of the direction or something like that elsewhere. Well I guess as long as the behavior is the same then it's all good. |
…24306) * Update Dart SDK to 2.12.0-259.9.beta * Fixed plumbing of the spawning isolate for Shell::Spawn. (#24112) * [canvaskit] update CSS size of the canvas when device-pixel ratio changes (#24160) * [web] Fix text selection from right to left (#24214) * [windows] Surface will not update when restoring (#24236) Co-authored-by: gaaclarke <[email protected]> Co-authored-by: Yegor <[email protected]> Co-authored-by: Mouad Debbar <[email protected]> Co-authored-by: Kaushik Iska <[email protected]>
When the user uses a mouse to select text dragging from right to left, the selection keeps flickering, and copying doesn't work. (dragging from left to right works fine).
This was introduced in flutter/flutter#71756. The framework started allowing reverse base/extent offsets for selection. That throws off the
<input>/<textarea>DOM element.Fixes flutter/flutter#74504