-
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: fix buffer for the triggering of multi-select #14448
Conversation
I'll see if I can add a test case. |
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.
The implementation is consistent with what I would expect to be an improvement based on the hypothesis in #12322 (comment) . The need for buffer I still find to be unfortunate, though would be happier to see an improvement than delay on it further.
The end-to-end test is great.
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.
Fixes the issue and the code is fine. Thanks for the e2e test!
Thanks for the reviews! @aduth Yeah the buffer is unfortunate, though I see no better way to address the issue. :/ |
Right, if I recall correctly, the issue is that the selection bounding box doesn't align neatly with the edges of the input it's in? I remember exploring this and finding it exceedingly difficult to measure that difference accurately, even going so far as to explore possible effects of various text metrics characteristics. |
Description
Fixes #12322.
Fixes the
buffer
for calculating whether, based on the text selection, multi-selection should be triggered or not. This buffer was originally added with only a collapsed selection in mind, so calculating the line height was a simple matter of taking the height of the selection rectangle.Solution: use
getComputedStyle
to get the line height from the browser.Why is this buffer needed in the first place? Depending on the browser, there may be a difference between the height of the selection rectangles and the line height. The selection rectangle may not reach all the way to the line edge. This is why we add a buffer that is the line height divided by two.
How has this been tested?
See #12322. Put the caret at the start of a paragraph that is at least 4 lines long. Press
shift+arrowDown
and ensure multi-block selection only starts after the last line has been selected.Screenshots
Types of changes
Checklist: