Skip to content

auto scroll to top after new items appended inside @totop event #270

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

Open
xrei opened this issue Sep 18, 2020 · 7 comments
Open

auto scroll to top after new items appended inside @totop event #270

xrei opened this issue Sep 18, 2020 · 7 comments
Labels

Comments

@xrei
Copy link

xrei commented Sep 18, 2020

Let say we have and some list of items, in the @totop event i fetch more items and concatenate them, and after that scroll immediately goes to 0 (at the very top) which is wrong, it should stay where it was before fetching new items.

is there any solutions?

actually i made one by finding id of last message before fetching new ones and finding that message in new list then scrollToIndex but the scroll still glitches i see that transition after very top to the index. it looks awful :(

@xrei xrei added the question label Sep 18, 2020
@tangbc
Copy link
Owner

tangbc commented Sep 18, 2020

Actualy you can't keep scroll position stay where it was before rendering new contents to head.

The way you can do is scrollTo an offset which is the addition items all height like chat-room demo.

@xrei
Copy link
Author

xrei commented Sep 18, 2020

@tangbc I've seen this demo, but it does not work, because vsl.getSize() returns undefined for some elements which are really exists

@tangbc
Copy link
Owner

tangbc commented Sep 18, 2020

vsl.getSize() base on ResizeObserver api, does your browser not support it?

@xrei
Copy link
Author

xrei commented Sep 18, 2020

@tangbc Latest Chrome. it sure does support ResizeObserver.

@tmadhavan
Copy link

I also seem to be seeing this issue, with getSize(id) returning undefined. Also on Chrome.

@TinaSprunt
Copy link

@xrei Did you find any workable solution? I also encountered this problem

@mokeen
Copy link

mokeen commented Sep 11, 2024

#396

This fix caused the problem,but I don't know why he did that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants