Skip to content
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

[WIP] Jumping issues with enableUnequalChildrenSizes #479

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jugst3r
Copy link

@Jugst3r Jugst3r commented Jan 5, 2021

A stackblitz reproducer which highlights a bit the problem; scroll to the middle, invalidate the cache, scroll upwards and see sometimes how the virtual scroller jumps. Obviously the problem is more concerning / visible on more complex components.

Description of the problem

Basically, this happens when unknown size items are on top of the already rendered items. When scrolling top, these items will eventually be rendered, but their size will be different than the one the virtual scroller expects. So if we want to be fine we will have to adjust, and I found no other thing than adjusting the scroll position. This doesn't fully fix the issue though, and there still seem to be some kind of jumping here and there, when slowly scrolling with the wheel. Do you have any idea on what I could be missing or if there could be a suitable work around?

I feel like this is also due to the activation of the scroll event when re-rendering the items (as the scroll position was modified by the virtual scroller with this fix) which re-triggers the refresh_internal method and can cause a useless re-rendering (making the screen blink). All my attempts at trying to avoid that by unlistening the scroll event failed.

Other attempts at fixing it

I also tried to implement a method which would basically avoid getting into that spot. It basically consists of implementing a getItemHeight injected method that can be provided by the component using the virtual scroller. This would theoretically enable the virtual scroller to know statically the width / height of each item. It also has drawbacks though, and even if I implemented it successfully, I don't think it is a suitable solution as the rendering has to be pixel perfect in order for it to work in all possible configurations (the height can change arbitrarily it seems, and the rendering is slightly different according to the navigators and the zoom value, even if height is explicitely set).

PS: sorry for the indentation modification, the template / style did not change one bit

When the items are of different size and take some time to render, the virtual
scroller may be in a situation where there are items on top of the ones that
are displayed that have not been rendered and thus measured by the cache yet.
With variable sizes, this can be a problem, as we rely on the cache, or on the
default size to measure the correct padding and avoid jumping issues when
scrolling top.
This commit tries to address this issue but still needs further work.
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.

1 participant