-
Notifications
You must be signed in to change notification settings - Fork 981
[ScrollArea] scroll-behavior: smooth
compatibility
#2175
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
Conversation
@@ -715,6 +715,7 @@ const ScrollAreaScrollbarImpl = React.forwardRef< | |||
// so we remove text selection manually when scrolling | |||
prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect; | |||
document.body.style.webkitUserSelect = 'none'; | |||
if (context.viewport) context.viewport.style.scrollBehavior = 'auto'; |
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.
Do we also need to do something to address the wheel interaction mentioned in the issue?
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.
No, I tested using my mouse wheel, and using my trackpad and there was no issue with those.
Similarly, I tested with touch drag on my iPhone and it was fine too.
This makes sense to me as it makes sense that scroll-behavior: smooth
takes that into account already.
@@ -725,6 +726,7 @@ const ScrollAreaScrollbarImpl = React.forwardRef< | |||
element.releasePointerCapture(event.pointerId); | |||
} | |||
document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current; | |||
if (context.viewport) context.viewport.style.scrollBehavior = ''; |
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.
Is there any risk that this event wouldn't fire? I'm curious as the capture release code is above this.
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.
I don't think so, what are you thinking?
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.
No, this looks good. Raising the question just in case 😄
Fixes #2064