Repository navigation
Description
Bug report
Current behavior
When ScrollArea is unmounted and remounted (inside a baseui Tabs.Panel in this case), the scrollbar thumb renders at the wrong size before correcting on the next user scroll. This is visible when ScrollArea.Scrollbar hasdisplay: flex or display: grid and the thumb has any padding.
The thumb also flashes with an initial height of 0 on page load with Next.js before correcting
Screen.Recording.2026-02-15.at.7.34.25.PM.mov
Expected behavior
The thumb should render at the correct size immediately on mount
Reproducible example
Stackblitz with repro in next.js: https://stackblitz.com/edit/stackblitz-starters-d9hre5ba?file=app%2Fpage.tsx
Base UI version
1.2.0
Which browser are you using?
Chrome
Which OS are you using?
Mac OS
Which assistive tech are you using (if applicable)?
n/a
Additional context
After grappling with this issue for a while, I was curious if this was a CSS issue on my end or a potential bug in the library. After reducing my implementation down to a bare minimum example, and still getting this issue, I started to suspect that the thumb size was being initialized with an incorrect value and corrected after the first paint.
To debug I went into node_modules and checked out ScrollAreaScrollbar and ScrollAreaViewport and left console logs to see what the --scroll-area-thumb-height css variable was being set to, and how often it was changing.
On mount, it did initialize to 0 before updating, and when switching tabs and then scrolling, the height went through three renders from 0px -> 403px on mount, and then to 464px when I began scrolling, which aligns with what I was visually observing.
I was able to partially work around this issue by passing keepMounted to my Tabs.Panel component, but the initial page load flash persists.
Activity
linear commentedon Feb 16, 2026
BAS-391
atomiks commentedon Feb 17, 2026
Have a fix in #4107
In the PR, the SSR behavior changes to hide the scrollbars entirely (unless you specify
keepMounted) until hydration. So the scrollbar just flashes in on hydration after mount. It's not possible to fix this without a pre-hydration<script>since the JS needs to run to determine the measurements of all the elementsThe Scroll Area component is mainly useful to add overlay scrollbars on hover or scroll rather than always-visible, unless it's in a popup that requires interaction first (e.g. the cmdk menu on the docs), due to this JS limitation.
github-actions commentedon Mar 4, 2026
This fix will be available in the next npm release of Base UI.
In the meantime, you can try it out on our Canary release channel: