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

Reverse scroll with dynamic height stops before actual top end #432

Closed
LookRain opened this issue Apr 20, 2024 · 3 comments
Closed

Reverse scroll with dynamic height stops before actual top end #432

LookRain opened this issue Apr 20, 2024 · 3 comments

Comments

@LookRain
Copy link
Sponsor

Describe the bug

In reverse scroll mode on iOS Safari, if the content have dynamic height and dynamic loading(just speculation), the scroll will end prematurely before the actual top of the list is reached. If you try to pull down immediately when the scroll stops, it still won't readjust and render more items on top. A short moment is required after scroll stops for more items to be rendered on top.

Simulator.Screen.Recording.-.iPhone.15.Plus.-.2024-04-20.at.14.55.14.mp4

To Reproduce

Use an iPhone or simulator, go to any of these examples, start scrolling up

  1. https://inokawa.github.io/virtua/?path=/story/basics-virtualizer--bi-directional-infinite-scrolling
  2. https://inokawa.github.io/virtua/?path=/story/advanced-chat--default
  3. https://inokawa.github.io/virtua/?path=/story/advanced-feed--default

It doesn't happen in the reverse example https://inokawa.github.io/virtua/?path=/story/basics-vlist--reverse , so I'm assuming it's got something to do with dynamically prepending items causing the height to be wrong?

Expected behavior

scroll should not stop before the actual top.

Platform:

  • OS: iOS
  • Browser: Safari
  • Version of this package: version in the storybook demo
  • Version of framework: version in the storybook demo

Additional context

@inokawa
Copy link
Owner

inokawa commented Apr 20, 2024

#403 (comment)

@inokawa inokawa closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2024
@LookRain
Copy link
Sponsor Author

thanks for the quick reply @inokawa

I came across this blog https://lovemewithoutall.github.io/it/setting-scrollTop-on-momentum-scroll/ which suggests a workaround

image

I assume you have tried this and it did not work?

@inokawa
Copy link
Owner

inokawa commented Apr 20, 2024

A similar workaround is used for an edge case in iOS Safari. It will apply scroll position but also stops the scrolling.

virtua/src/core/scroller.ts

Lines 283 to 286 in a567e46

style[overflowKey] = "hidden";
timeout(() => {
style[overflowKey] = prev;
});

Maybe there is room for improvement, but basically I think it's inevitable in reverse virtual scrolling with dynamic sized items.

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

No branches or pull requests

2 participants