-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Text editing shift + tap + drag interaction #95213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
565a4ef to
18dfff9
Compare
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.
Maybe add one more step of moving the mouse after releasing the shift key, which, according to my test on macOS, continues the range selection.
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.
Added. Thanks for catching that, I didn't think to try it.
|
Another behavior we might be interested in testing is shift-tapping a text field when it is not focused.
|
|
Another behavior worth checking is shift-tapping multiple times (instead of dragging).
(Sorry for adding complexity that might be beyond the scope of this PR. Should I file them as separate issues?) |
dkwingsmt
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.
I see no problem in this PR, but I suggest adding one extra step as commented above.
|
@dkwingsmt Thanks for thinking about all of these other behaviors. There are so many edge cases when it comes to stuff like this.
I'll go ahead and merge this PR when/if it goes green. |
|
Here's the PR for shift-tapping on an unfocused field: #97543 |
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.
is it true that _shiftTapDragSelection != null if and only if _isShiftTapping is true? If so then you need only one variable to track the state?
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.
It's not true unfortunately. _isShiftTapping will be true when just shift tapping (not dragging) while _shiftTapDragSelection will be null.
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.
nit: What if renderEditable.selection is invalid at this point?
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.
I think I intended to prevent that with the if above, I'll update it so it can't be null here.
7b1771c to
02b70a9
Compare
Supports the desktop text editing interaction of holding shift, tapping the field, and dragging to modify the selection.
After #93835 added support for shift + tap to expand text selection in an input, this PR will add support for shift + tap and then dragging to move the extent.
Fixes #91979
Mac has some non-trivial behavior that made this PR more complex than I thought it would be. When the selection is inverted, it restores the original selection from the time of tapdown. See this video, which shows this PR duplicating Mac's behavior.
Screen.Recording.2021-12-13.at.3.58.56.PM.mov