Skip to content
Source
Sign inSign up
TanStack/virtual

Reach browser max height pixels #616

Openhyanmandian(GitHub profile, opens in a new tab) opened this issue 3 comments

Describe the bug

I'm doing some POC to check if I'll be able to render a larger list and I face some issues with the current approach you use by setting the height of the parent element to create the scrollable area. If the list size is long it could beat the max height value which is:

Firefox: 33554400px
Chrome:  33554428px

https://stackoverflow.com/questions/16637530/whats-the-maximum-pixel-value-of-css-width-and-height-properties

In that way is impossible to keep scrolling until the end of the list

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/romantic-breeze-tjpnxm?embed=1&file=%2Fsrc%2Fmain.tsx%3A4%2C21

Steps to reproduce

  • Create a list with 1677723 items and each item should have 20px
  • Cannot scroll to see the last item

Expected behavior

  • Create a list with 1677723 items and each item should have 20px
  • Be able to see the last item

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

macOS - Chrome

tanstack-virtual version

3.0.0-alpha.1

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.
  1. @hyanmandian I've managed to solve this problem by implementing custom scrollbar described in this article.

    https://dev.to/kohii/how-to-implement-virtual-scrolling-beyond-the-browsers-limit-16ol

  2. piecykcommented

    @acherkashin Wow, that’s awesome, thanks for sharing! 🙌 Would you be open to sharing your solution? I’d be happy to accept a PR with an example if you’re up for it.

  3. Hey @piecyk I’ve just raised a PR to address this issue.

    I implemented a native, built-in scroll-scaling mechanism directly in virtual-core. When a list's total virtual size exceeds a configurable threshold (maxScrollSize, defaulting to 33,000,000 px), the virtualizer automatically applies a scale factor to compress the scroll range.

    This solves the browser's ~33.5 million pixel scroll height limitation in a fully framework-agnostic way (requiring zero changes to existing adapters like React, Vue, Solid, etc.), while introducing zero overhead for standard lists where scale === 1. Would love to hear your feedback on the PR!

Sign in to join this conversation.