Skip to content

Fixed stuck at scroll location#60

Closed
adamrpostjr wants to merge 3 commits into
sveltejs:masterfrom
adamrpostjr:master
Closed

Fixed stuck at scroll location#60
adamrpostjr wants to merge 3 commits into
sveltejs:masterfrom
adamrpostjr:master

Conversation

@adamrpostjr

Copy link
Copy Markdown

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

Fixed the issue where you're stuck in the scroll location during update of the items in the virtual list.. such as a search.
Tested more and fixed bug with not updateing
@webmasterkai

Copy link
Copy Markdown

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...

Comment thread VirtualList.svelte Outdated
When I copied from my own code I forgot to reformat
@webmasterkai

Copy link
Copy Markdown

That was fast. I wonder, is #52 solving the same problem?

@adamrpostjr

Copy link
Copy Markdown
Author

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

@gitbreaker222

gitbreaker222 commented Jan 23, 2022

Copy link
Copy Markdown

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

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.

@adamrpostjr adamrpostjr closed this by deleting the head repository Jul 16, 2025
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

Successfully merging this pull request may close these issues.

4 participants