Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adding content in the "before" slot impacts the buffer size #510

Closed
Simon-JB opened this issue Sep 21, 2020 · 2 comments
Closed

Adding content in the "before" slot impacts the buffer size #510

Simon-JB opened this issue Sep 21, 2020 · 2 comments

Comments

@Simon-JB
Copy link

Use case
My virtual scroller contains some kind of music sheet that scrolls from top to bottom, with a scroll animation tied to a timer and the "current notes" being targeted to the middle of the screen. To achieve this, I add an empty div with a height of 50vh in the "before" slot so that the last item of the list reaches the middle of the screen when the scrolling ends.

The Problem
The buffer value seems to be affected by the size of the "before" div, which makes no sense because the div is part of the list and not fixed on screen. If I remove this 50vh div, a buffer value of 200px is enough to fill the virtual scroller without gaps. I I add the div and leave the buffer value at 200px, my items start to show up at the middle of the screen with a big gap at the top.
I have to double or triple the buffer value to account for his empty div, which has a big impact on performance.

Shouldn't the buffer area be independant from what is in the before and after slots ?

I can try to set up a quick codepen if needed to reproduce the problem.

@Simon-JB
Copy link
Author

Simon-JB commented Sep 21, 2020

I modified an existing codesandbox to show what I mean.
It seems the problem also lies with the fact that the wrapper has a fixed height + overflow:hidden (because obviously I want the recyclescroller itself to be scrollable and not the div around it)

https://codesandbox.io/s/bug-with-before-slot-fg7lq

As you can see when you scroll, there is a "blank" area at the top of the div due to the buffer not covering up this part of the screen.
I you go and remove the div in the before slot, this area disappears.
<template slot="before"> <div style="background-color:grey;height:50vh;width:100%;"> <div :key="header" class="th" v-for="header in headers">{{ header }}</div> </div> </template>

@golinka
Copy link

golinka commented Jun 4, 2021

I have the same issue

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

No branches or pull requests

3 participants