Sticky header in a useReactTable table with useVirtualizer disappears when scrolling
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- react, typescript
- Domínio
- frontend, performance
Direção de pesquisa
Comece com a reprodução mínima vinculada no CodeSandbox e inspecione como useReactTable, useVirtualizer, o contêiner rolável e o wrapper que contém os itens virtualizados interagem. Reproduza o desaparecimento do thead durante a rolagem no Chrome e, em seguida, verifique se o cabeçalho sticky permanece visível sem fazer com que as linhas virtualizadas se expandam incorretamente.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 7.2k
- Forks
- 495
- Merge médio
- 23h 16min
- PRs com merge (30d)
- 19
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TanStack/virtual
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
Mantenedores costumam responder em até 1 dia
-
With `useScrollendEvent`, scrollToIndex and scrollToEnd stop short when the target moves while they settleTalvez já em andamento @Darkatse assumiu há 11 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
Mantenedores costumam responder em até 1 dia
-
svelte-virtual renders no rows when the scroll element is bound after the store subscribesTalvez já em andamento @clean99 assumiu há 15 dias. Aberta
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
-
anchorTo: 'end' does not keep the reading position when only paddingStart changesTalvez já em andamento @duongynhi000001-crypto assumiu há 15 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 30/100
Mantenedores costumam responder em até 1 dia
-
anchorTo: 'end' loses the end when the scroll element shrinksTalvez já em andamento @langleyd assumiu há 44 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
Todas as issues de TanStack/virtual
Issues semelhantes
-
inference/go type/feature
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 72/100
anomalyco/opencode#65148 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
truapi-release
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
paritytech/product-sdk#529 ·
Mantenedores costumam responder em até 1 dia
-
Add: Mansudae TVAbertaapproved check:passed streams:add
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
Mantenedores costumam responder em até 1 dia
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
devlikeapro/waha#2369 ·
Mantenedores costumam responder em até 5 dias