svelte-virtual-list icon indicating copy to clipboard operation
svelte-virtual-list copied to clipboard

Fixed stuck at scroll location

Open adamrpostjr opened this issue 3 years ago • 4 comments

Fixed the issue where you're stuck in the scroll location during update of the items in the virtual list.. such as a search on the list of items

adamrpostjr avatar Jan 01 '22 05:01 adamrpostjr

I also experience this problem. I was following an example here https://svelte.dev/repl/a138b0c8579b4fc8bdde842a9d922b1f?version=3.17.1 and realized it's running a customized version of VirtualList.svelte to solve the issue. Came here and found your PR :-)

Looks like it's been a few years since this package has been updated...

webmasterkai avatar Jan 05 '22 23:01 webmasterkai

That was fast. I wonder, is https://github.com/sveltejs/svelte-virtual-list/pull/52 solving the same problem?

webmasterkai avatar Jan 05 '22 23:01 webmasterkai

I havnt tested myself but it looks like it may be!

adamrpostjr avatar Jan 06 '22 00:01 adamrpostjr

hi @webmasterkai - I'll have a look, if our changes are crossing paths :smiley: ....

edit correction: of course these changes here are from @adamrpostjr . They eventually do the same as #31. In my PR #52 I've solved the problem in a different way: I don't scroll to top on change, but instead somehow detect, if the scroll position is below the new list length. If yes, it scrolls to the new end via the new method scrollTo(). This way it feels more stable, because you can e.g. filter without "loosing" your scroll position.

gitbreaker222 avatar Jan 23 '22 12:01 gitbreaker222