I am currently trying to understand the concepts of virtual scrolling and for that I extensively used the Angular documentation on Angular's CDK. I found out that they implemented virtual scrolling but they do not show how to implement a list on a page.
To give you a better understanding of my problem: Consider building a page of a collection of states. You have a big header section, then the list of states and at the end a footer with recommendations.
What I tried to do is to put all these 3 sections into the virtual scroll viewport in order to make the whole page scrollable and not only the list itself. And there is the problem. The scrolling does work as expected, but some items of the list get detached to early, so the header section sometimes bounces back in. This causes a pretty bad user experience and I wanted to know if my approach is somehow going into the right direction. I created a short demo of the problem on Stackblitz. I hope this might help understand the problem. When visiting the link, try and scroll the contents. You should notice that the Header section often reappears on the top because items get removed too soon.
I hope I could give you an idea on what the problem exactly is. It would be very nice if some of you could help me solve this issue or give me a hint on how to implement such behaviour better.
Have a great day & Thank you kindly in advance!