svelte-virtual-list
svelte-virtual-list copied to clipboard
Fixed stuck at scroll location
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
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...
That was fast. I wonder, is https://github.com/sveltejs/svelte-virtual-list/pull/52 solving the same problem?
I havnt tested myself but it looks like it may be!
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.