Open jamiebuilds-signal opened 1 year ago
I have the same issue. No update/workaround?
Okay, I figured out how to fix the issue using pure css:
I check if the vertical scrollbar doesn't exist then reset --radix-scroll-area-corner-width
to 0
and the same way for the horizontal scrollbar.
If you are using tailwind you need to add these class names to the Scroll Area Root element:
<ScrollAreaPrimitive.Root
className={cn(
// The following two lines fix this radix issue: https://github.com/radix-ui/primitives/issues/2383
"[&:not(:has(>[data-orientation='vertical']))]:[--radix-scroll-area-corner-width:0_!important]",
"[&:not(:has(>[data-orientation='horizontal']))]:[--radix-scroll-area-corner-height:0_!important]",
className
)}
{...restProps}
>
Bug report
Current Behavior
When changing the height and size of the scroll container, making either the vertical or horizontal scrollbars appear and disappear. The
--radix-scroll-area-corner-width/height
custom properties should be flipping back to0
after one of the scrollbars appearExpected behavior
Right now if both scrollbars are ever visible, the
--radix-scroll-area-corner-width/height
custom properties will stick around (ex.8px
) forever.Reproducible example
https://codesandbox.io/s/radix-scrollarea-bug-corner-css-custom-props-jv84rh
Suggested solution
--radix-scroll-area-corner-width/height
should revert to0
Additional context
Your environment
You can see this in the latest version of
@radix-ui/react-scroll-area
in the code example.