Skip to content
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

Only make scrollToRow smooth #2200

Merged
merged 2 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ function DataGrid<R, SR>({
scrollToRow(rowIdx: number) {
const { current } = gridRef;
if (!current) return;
current.scrollTop = rowIdx * rowHeight;
current.scrollTo({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work in safari
https://caniuse.com/?search=scrollTo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions
ScrollToOptions is supported, but the smooth option isn't supported yet so it'll be ignored.

Last modified: Aug 21, 2019

The mdn page hasn't been updated for over a year so it's probably safe to use this.

top: rowIdx * rowHeight,
behavior: 'smooth'
});
},
selectCell
}));
Expand Down
1 change: 0 additions & 1 deletion style/core.less
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
background-color: var(--background-color);
color: var(--color);
font-size: var(--font-size);
scroll-behavior: smooth;

*,
*::before,
Expand Down