The react table example doesn't make the <table> element large enough
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 466
- Avg merge
- 2d 31m
- Merged PRs (30d)
- 13
Description
Describe the bug
In the "React Virtual Table Example", the translateY approach to row positioning allows rows to be positioned outside of the <table> element.
This causes issues with at least two things:
- A sticky header (
<thead style="position:sticky;top:0">) cannot go beyond the bounds of the<table>element - Borders on
<tr>elements stop displaying when the<tr>element is outside of the bounds of the<table>element (in Chrome & Firefox)
It's also worth noting that intentionally changing the size of the table causes the rows to become huge, so that doesn't appear to be a solution.
Unless something can be done about the size of the <table> element, it may be best to suggest the padding-rows approach (such as the one used in the "React Table Virtualized Rows Example" in the TanStack Table docs).
Your minimal, reproducible example
https://tanstack.com/virtual/v3/docs/examples/react/table
Steps to reproduce
- Go to the "React Virtual Table Example" page in the documentation
- Change
<thead>to a sticky header (<thead style="position:sticky;top:0">) - Scroll down in the result until the header disappears
Expected behavior
<thead style="position:sticky;top:0"> should remain sticky through the entire table's scrolling.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: Windows 11
- Browser: Vivaldi 6.2.3105.47
tanstack-virtual version
3.0.0-beta.60
TypeScript version
No response
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the React Virtual Table Example linked in the issue and reproduce the sticky-header behavior by changing thead to position:sticky;top:0. Compare its translateY row-positioning approach with the padding-rows approach in the React Table Virtualized Rows Example. Done means the sticky header remains visible through scrolling and row borders continue displaying without making rows excessively large.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- documentation, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100