Sticky header in a useReactTable table with useVirtualizer disappears when scrolling
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react, typescript
- Ambito
- frontend, performance
Direzione di ricerca
Inizia con la riproduzione minima collegata in CodeSandbox e analizza come interagiscono useReactTable, useVirtualizer, il contenitore scorrevole e il wrapper che contiene gli elementi virtualizzati. Riproduci la scomparsa del thead durante lo scorrimento in Chrome, quindi verifica che l’intestazione sticky rimanga visibile senza causare un’espansione errata delle righe virtualizzate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
When using a react-table together with vritualizer and a sticky header the sticky header disappears when scrolling. This is due to the fact that when combining the two the table should be wrapped in two divs:
- The container that takes the height that should be taken up. This is the div that is scrollable
- The div that directly wraps the container and takes the height of all the virtual items combined
Since the table element at any given time only contains the visible rows (plus overscan) the table itself has a height smaller than the wrapper div (nr. 2). This causes the sticky header to disappear when you scroll down since the sticky header cannot escape the table element.
Your minimal, reproducible example
https://codesandbox.io/p/devbox/tanstack-react-virtual-example-dynamic-mr8t3x
Steps to reproduce
- Add
position: stickyto thetheadelement - Scroll down the table and watch how the header dissapears
Expected behavior
The header should stay on top since it is sticky.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Chrome
tanstack-virtual version
3.0.0-beta.68
TypeScript version
5.3.2
Additional context
I've tried getting rid of the wrapper div (nr. 2) and setting the height: ${getTotalSize()}px` directly on the table element but this causes the rows' height the grow because there are only ever enough rows to fit on the screen (plus overscan) but having the table the full height causes the rows to evenly divide the space between each other (making them a lot larger).
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.
- Lingua principale
- TypeScript
- Stelle
- 7.2k
- Fork
- 495
- Merge medio
- 23h 16m
- PR unite (30g)
- 19
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/virtual
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
With `useScrollendEvent`, scrollToIndex and scrollToEnd stop short when the target moves while they settleForse già presa @Darkatse l’ha presa 11 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
svelte-virtual renders no rows when the scroll element is bound after the store subscribesForse già presa @clean99 l’ha presa 15 giorni fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
anchorTo: 'end' does not keep the reading position when only paddingStart changesForse già presa @duongynhi000001-crypto l’ha presa 15 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
I maintainer di solito rispondono entro 1 giorno
-
anchorTo: 'end' loses the end when the scroll element shrinksForse già presa @langleyd l’ha presa 44 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TanStack/virtual
Issue simili
-
inference/go type/feature
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
anomalyco/opencode#65148 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
truapi-release
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
paritytech/product-sdk#529 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: Mansudae TVApertaapproved check:passed streams:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
devlikeapro/waha#2369 ·
I maintainer di solito rispondono entro 5 giorni