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

Only make scrollToRow smooth #2200

merged 2 commits into from
Nov 2, 2020

Conversation

nstepien
Copy link
Contributor

@nstepien nstepien commented Nov 2, 2020

scroll-behavior: smooth; made all scrolling smooth, including keyboard navigation, which is probably not desirable, especially when holding arrow keys.
I've made it so only scrollToRow is smooth.

@nstepien nstepien self-assigned this Nov 2, 2020
@@ -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.

@amanmahajan7 amanmahajan7 merged commit d6866c9 into canary Nov 2, 2020
@amanmahajan7 amanmahajan7 deleted the smooth branch November 2, 2020 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants