-
Notifications
You must be signed in to change notification settings - Fork 860
[Data Grid] Account for text being selected when cell scrolls into view #9276
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
base: main
Are you sure you want to change the base?
[Data Grid] Account for text being selected when cell scrolls into view #9276
Conversation
this ensures the interaction is reliable, since scrolling will only happen after the pointer is up
Co-authored-by: Lene Gadewoll <lene.gadewoll@elastic.co>
💚 Build SucceededHistory
cc @acstll |
💚 Build Succeeded
History
cc @acstll |
| useEffect(() => { | ||
| if (focusedCell) { | ||
| // do not scroll if text is being selected | ||
| if (isPointerDown || window?.getSelection()?.type === 'Range') { |
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.
Now that I think about it: Should we add some tests for this to verify scrolling doesn't happen in this 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.
aha! it wouldn't hurt, let me give it a try!
Summary
Relates to elastic/kibana#245368
In
EuiDataGrid, when you click e.g. focus on a cell that is not fully visible, it will instantly scroll fully into view. Both axis. If you try to select text on a cell that is not fully visible, the scrolling will block you from making the selection.This PR adds a small check for the text selection use case, right before doing the automatic scroll.
Let's tests this to see if it makes sense.It's been manually tested and fulfills the request in elastic/kibana#245368Why are we making this change?
It's a papercut kind of fix. It improves UX.
Screenshots
Before
Check the clip in elastic/kibana#245368
After
Clip
Impact to users
🟢 None. No API or type changes.
QA
General checklist
@defaultif default values are missing) and playground toggles