-
-
Notifications
You must be signed in to change notification settings - Fork 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 Report][3.7.1] v-virtual-scroll will not scroll to newly created item using scrollToIndex #20482
Comments
It has a frame debounce, you will have to use requestAnimationFrame instead of nextTick: vuetify/packages/vuetify/src/composables/virtual.ts Lines 184 to 187 in 7d3557a
scrollToIndex should be async and wait for render before returning. setTimeout(50) might work sometimes but will break if you get a frame that takes over 50ms. |
I have tried your instructions and it solves one part of the issue. When you are at the bottom of the list and add another item, it now displays the next item. However, if you are not add the bottom of the list and add another item, it will still scroll to the second to last item in the list. Maybe I have misunderstood your instructions. Can you provide a working example? |
This look like my closed issue |
Did your solution work for you? I still seem to get the same error with your solution. If you are already on the last element and add another, it correctly scrolls to the newly added element. However, if you aren't at the bottom of the list, it scrolls to the second to last element. |
also affecting me |
what i had going on was after scrolling to bottom, a moment later the scrollHeight would increase by an item's height. The list size wasn't changing. |
This works for me too. Still hoping the correct fix gets implemented soon, but this works for the time being. |
Here's a workaround fix for you. Should be okay until the proper solution is implemented. |
Hi @griffinallen, I tested it and is working. Quick fix until the proper solution. Thanks for the help, greatly appreciated. |
Environment
Vuetify Version: 3.7.1
Vue Version: 3.5.6
Browsers: Chrome 128.0.0.0
OS: Windows 10
Steps to reproduce
Expected Behavior
The list should be scrolled so that the newest added item is now visible.
Actual Behavior
The list scrolls such that the second to last item is visible, but the newly added item is still not visible.
Reproduction Link
https://play.vuetifyjs.com/#...
The text was updated successfully, but these errors were encountered: