Input Interaction: fix buffer for the triggering of multi-select#14448
Input Interaction: fix buffer for the triggering of multi-select#14448
Conversation
|
I'll see if I can add a test case. |
aduth
left a comment
There was a problem hiding this comment.
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.
oandregal
left a comment
There was a problem hiding this comment.
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
bufferfor 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
getComputedStyleto 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+arrowDownand ensure multi-block selection only starts after the last line has been selected.Screenshots
Types of changes
Checklist: