-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
scrollToIndex leads to blank screen during inertia scroll on iOS Safari #483
Comments
Current logic defers jump compensation in iOS Safari during scrolling and freezes visible range during imperative smooth scrolling in every browsers. So smooth scroll during inertia scrolling will cause weird behavior. |
actually it's not just smooth scrolling, in the video |
Oh, thanks. Maybe it's fixable if it happened without smooth option. |
@inokawa Any Virtua API i can use to stop the scroll? if no, would modifying the scroll container to overflow:hidden do the trick? many thanks! |
I think it is the only way in iOS Safari as far as I know. Or you can disable scrollTo button while scrolling for some use case. |
@inokawa I'm thinking we can add a check for the scrollToIndex function, and disable scroll before the rest of the scroll logic. if that is what you had in mind, I could try and submit a PR? |
Yeah, PR is welcome. I thought it may solve the problem to discard current jumps(maybe just call For reference, Virtua locks visible range while smooth scrolling here: Line 434 in 63e9285
Lines 209 to 214 in 63e9285
|
Thanks for this amazing library @inokawa I tried this trick and worked fine: const chatContainer = document.getElementById(chatContainerId);
if (chatContainer && isIOS) {
chatContainer.style.overflow = 'hidden';
setTimeout(() => {
chatContainer.style.overflow = 'auto';
ref.current?.scrollTo(1e8);
}, 0);
} else {
ref.current?.scrollTo(1e8);
} It would be great if we can have something like this in Virtua itself. Also not sure if it is fine to use |
Describe the bug
Calling
scrolLToIndex
in middle of a scroll on iOS Safari has a very high chance of getting a blank screenScreenRecording_08-06-2024.12-48-28_1.mp4
To Reproduce
Expected behavior
Should scroll to intended target
Platform:
iOS Safari
Additional context
I understand this probably is because of the weird thing Apple does to the scroll behavior on Safari, but is there any possible workaround this issue, like stopping the scroll before firing scrollToIndex? @inokawa
The text was updated successfully, but these errors were encountered: