We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 430a5e9 commit 604a640Copy full SHA for 604a640
1 file changed
packages/eui/src/components/datagrid/utils/scrolling.tsx
@@ -52,10 +52,18 @@ export const useScroll = (args: Dependencies) => {
52
const { focusedCell } = useContext(DataGridFocusContext);
53
useEffect(() => {
54
if (focusedCell) {
55
- scrollCellIntoView({
56
- rowIndex: focusedCell[1],
57
- colIndex: focusedCell[0],
58
- });
+ setTimeout(() => {
+ // do not scroll if text is being selected
+ // (120ms feels almost instant when clicking
+ // but seems enough time to catch the text selection)
59
+ if (window?.getSelection()?.type === 'Range') {
60
+ return;
61
+ }
62
+ scrollCellIntoView({
63
+ rowIndex: focusedCell[1],
64
+ colIndex: focusedCell[0],
65
+ });
66
+ }, 120);
67
}
68
}, [focusedCell, scrollCellIntoView]);
69
0 commit comments