vue-virtual-scroll-list icon indicating copy to clipboard operation
vue-virtual-scroll-list copied to clipboard

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

Open xrei opened this issue 5 years ago • 7 comments

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 avatar Sep 18 '20 00:09 xrei

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.

tangbc avatar Sep 18 '20 06:09 tangbc

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

xrei avatar Sep 18 '20 09:09 xrei

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

tangbc avatar Sep 18 '20 11:09 tangbc

@tangbc Latest Chrome. it sure does support ResizeObserver.

xrei avatar Sep 18 '20 12:09 xrei

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

tmadhavan avatar Sep 23 '20 13:09 tmadhavan

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

TinaSprunt avatar Nov 09 '23 06:11 TinaSprunt