`useVirtualizer({paddingEnd: 800})` creates overscroll issue with `scrollToIndex(last)`
Los mantenedores suelen responder en 1 día
@dikshit-n ya está trabajando en esto.
Desde el 10/9/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- react, typescript
- Área
- frontend
Línea de trabajo
Comienza con la reproducción mínima enlazada y sigue los puntos de entrada useVirtualizer y scrollToIndex, centrándote en el comportamiento de paddingEnd y last-index. Reproduce el problema con los botones proporcionados y, a continuación, verifica que desplazarse hasta el último índice mantenga el elemento completamente visible sin desplazar el contenedor más allá de lo debido.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
The paddingEnd option for the useVirtualizer callback is not correctly taken into account when using rowVirtualizer .scrollToIndex(last). Instead the function call scrolls to the end of the scroll container. For every other index this works as intended.
const rowVirtualizer = useVirtualizer({
count: 100,
getScrollElement: () => parentRef.current,
estimateSize: () => 35,
overscan: 5,
paddingEnd: 800
})
// ...
<button onClick={() => {
rowVirtualizer.scrollToIndex(98)
}}>
Scroll to 98 (works)
</button>
<button onClick={() => {
rowVirtualizer.scrollToIndex(99)
}}>
Scroll to 99 (overscrolls)
</button>
Your minimal, reproducible example
https://github.com/Freymaurer/tanstack-virtual-padding-overscroll-bug-example
Steps to reproduce
- Clone and
npm i->npm run devthe example (fresh vite-react-ts with tanstack virtual dependency) -> open the link printed to console - Click the buttons i added on top of the view
- "Back to Start" uses
scrollToIndex(0) - "Scroll to 98 (works)" scrolls to 98, so not last index
- "Scroll to 99 (overscrolls)" scrolls to the last index
- Click on "Back to Start", then "Scroll to 98 (works)". It scrolls with pretty good alignment. The field is shown on the bottom of the scrollContainer
- Click on "Back to Start", then "Scroll to 99 (overscrolls)". It overscrolls, the element is not visible on screen. 🐛 I think this is due the library calling more or less "scrollToEnd" instead of "scrollTo" in this scenario.
Expected behavior
I expected the behavior to be consistent. The element at last index should be fully visible after calling the scroll function, instead of scrolling to the scroll container end
How often does this bug happen?
Every time
Screenshots or Videos
After clicking on "Scroll to 98 (works)"
After clicking on "Scroll to 99 (overscrolls)"
Platform
OS: Windows 11
Browser: Tested on Chrome, Edge, Firefox, Opera
tanstack-virtual version
v3.14.9
TypeScript version
v6.0.3
Additional context
No response
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- Lenguaje dominante
- TypeScript
- Estrellas
- 7.1k
- Forks
- 472
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 12
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/virtual
-
measureElement caches 0 size for nodes that aren't attached yet (Vue: rows stack at start 0 and the list scrolls away on mount)Posiblemente ocupada @webn00b la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
`scrollToIndex(last, { align: 'end' })` stays short of the end after a measured row grows (virtual-core ≥ 3.17.0)Posiblemente ocupada @minwookshin la tomó hace 6 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
TanStack/virtual#1290 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
virtual-core: desktop Safari drops the prepend anchor write when history lands during the top rubber-band bouncePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
marko-virtual: scrollToEnd during an in-flight prepend strands the view one prepend above the bottom (chat-pretext e2e fails on CI)Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/virtual
Issues similares
-
Upgrade node-libzim to 4.7.0Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
openzim/mwoffliner#2933 ·
Los mantenedores suelen responder en 1 día
-
Use the README category name for website links and submissionsPosiblemente ocupada @dajiaohuang la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
birobirobiro/awesome-shadcn-ui#647 ·
Los mantenedores suelen responder en 2 días
-
Add: Valea Prahovei TV RO SDAbiertocheck:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Urigo/accounter-fullstack#4604 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día