TanStack / TanStack/virtual

The react table example doesn't make the <table> element large enough

Open
#585 11 comments 7 reactions 0 assignees View on GitHub

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:

  1. A sticky header (<thead style="position:sticky;top:0">) cannot go beyond the bounds of the <table> element
  2. 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
  1. Go to the "React Virtual Table Example" page in the documentation
  2. Change <thead> to a sticky header (<thead style="position:sticky;top:0">)
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.