-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Input Interaction: only consider selection at edge if directed towards it #14450
Conversation
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.
Generally, this is great.
There's one small imperfection by the logic, and it's OS-specific as well. Per #13638 (comment) , the behavior of Shift+Up in a non-collapsed selection in a line of a text in non-macOS environments is that it should expand to the previous line (or in our case, if in the first line of a paragraph and a block preceded it, triggering multi-selection). Right now, the behavior is that nothing happens. Effectively in this scenario, I think it might be correct to say that it is at the vertical edge, even if the selection is non-collapsed.
That being said, what exists here is a huge improvement all the same, so I'd like to see it merged.
@@ -169,7 +169,18 @@ export function isVerticalEdge( container, isReverse ) { | |||
} | |||
|
|||
const selection = window.getSelection(); | |||
|
|||
// Only consider the selection at the edge if the direction is towards the | |||
// edge. |
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.
Love the dedication to the 80 column 👍
8ea31fe
to
ebb0d9a
Compare
@aduth Thanks for the review! I'll have a look into the issue you're describing, maybe we can fix it separately. |
@aduth Looking at your GIF, it seems like a consecutive |
Or am I missing something that would block multi-block selection after these steps? |
The specific point I'm trying to make could do for a better / different animation, I think. Essentially: Everywhere except macOS, if an uncollapsed selection exists within a single line, the effect of pressing ArrowUp (with Shift held) should be to expand the selection to the previous line. In terms of blocks, that may mean triggering a multi-selection. Or, at the very least, it's contradictory to the idea here that a vertical edge traversal can never occur with an uncollapsed selection. |
@aduth I think I slowly get what you mean. It would be good to have an issue with the steps to reproduce the issue, and what you'd expect to happen vs what happens now in |
…s it (#14450) * Input Interaction: only consider selection at edge if directed towards it * Add e2e test
…s it (#14450) * Input Interaction: only consider selection at edge if directed towards it * Add e2e test
Closes #12322
Description
An alternative to #13638. I chose to make the selection direction check inside
isVerticalEdge
, as we do the same forisHorizontalEdge
.Still needs tests.How has this been tested?
Screenshots
Types of changes
Checklist: