-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
bug(cdk-virtual-scroll): Scrolling fast makes the viewport blank until scrolling stops #20971
Comments
How did you find out about the "fix": <div style="position: absolute; top:0; left:0; width:100%; height:100%; pointer-events:none"></div> |
Because it didnt have the problem in another app and after i investigated i saw cdk overlay "fixed" it. And that's how i got to it. |
This is actually done intentionally so that we're not constantly rendering new elements while the user is rapidly scrolling which would be detrimental to performance. However, there is probably some room to improve this by showing some kind of lightweight placeholder elements so the user doesn't think its lagging. |
@mmalerba The lightweight placeholder idea is a great idea! Hope it can be added as opt in. The only mystery left is the so called fix using the absolute positioned div |
This seems to be Note: I also reproduced this bug in Chrome using a very long list of elements (>50,000) without the |
It would be great to be able to configure which strategy the virtual scroll uses to deal with this, as it seems many users experience the view to be slower when they see this visual pop-in effect, compared to a slight delay during the scrolling that doesn't leak the details of the virtual scroll strategy. (though I understand the total time spent by the render thread in the former case is much lower) |
This is a really weird but helpful fix to this issue. Thanks @Harpush ! Here is the sample - https://stackblitz.com/edit/angular-qxcwbr-lyk95e?file=src%2Fapp%2Fcdk-virtual-scroll-context-example.html Anyways, there must be some kind of explanation for this behaviour and proper workaround will be helpful and mostly useful. |
what a bizarre fix indeed but it sure did fix that.. it was driving me crazy. grateful for the share here! similar to that... any one noticed that the cdk virtual on a dropdown (I have it on a custom data table dropdown - once you scroll the list and make a choice - then reopen the dropdown - the list is blank until you start scrolling the list... any fixes anyone know of? as soon as you start scrolling the list shows up doesnt happen everytime but does happen more than 50% of the time on a large list |
How to fix the "fix" in chrome? scroll with white screen(prefered) scroll without white screen( stuck, not prefered, but we do need the fixed wartermark) codesandbox demo: https://codesandbox.io/s/bold-beaver-3l41sk?file=/index.js UPDATEDthis comment is covered here bvaughn/react-window#455 (comment) thanks, closed. |
What is currently working for me in this situation: repeated opening of dropdown presents blank content until re-scrolled, is to call the QueryList first item, call scroll on that item, then set scrolltop of the scroll container to 0. Then wrap it up in a friendly "force it to the bottom of the call stack" setTimeout. // Do this at the end of your open click event or down arrow call. When the dropdown opens again, the content is there and I do note a slight appearance of the scroll bar appearing in the top right corner for a brief moment, but the contents is stable and you don't see it actually scroll even if the user scrolled before opening it up the second time. Note: This was working a year ago with just setting the scrolltop to 0, but as of 9/9/2023 it now requires the above and in that order. Second Note: In my case, I have an input (autocomplete) that works with the dropdown. When any activity occurs in the drop-down, it triggers the blur event, which always calls this.element.nativeElement.focus(); This is to return focus back to the input. This may also have something to do with it. In any case, keep trying there are ways to get it to work. I no longer have the blank issue. |
Running Angular v17 the |
Reproduction
https://stackblitz.com/edit/angular-qxcwbr
Steps to reproduce:
There are two virtual scroll viewports - the first has the problem. Take the scroll bar with the mouse and scroll down fast. The whole viewport will be blank as long as you scroll.
The second viewport uses a bizarre fix and if you try the same it will magically work.
Expected Behavior
Both of the viewports should scroll without viewport going blank
Actual Behavior
Without the bizarre fix the viewport becomes blank while fast scrolling
Environment
The text was updated successfully, but these errors were encountered: