Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/react/src/components/scroll-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ function ScrollArea({
className={cn("relative", className)}
{...props}
>
{/* Radix wraps the children in a `display: table; min-width: 100%` div.
A table grows to its widest child's max-content (e.g. a long,
non-wrapping code line), so it escapes the viewport's `overflow-x:
hidden` and clips content instead of letting it wrap or scroll within.
`[&>div]:!block` forces that wrapper back to a block bounded by the
viewport width, so the content fits and any inner scroller (CodeBlock)
owns its own horizontal overflow. Direct child (`>div`) only — a
descendant match would flatten the grid/flex layouts inside. */}
<ScrollAreaPrimitive.Viewport
data-slot="scroll-area-viewport"
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 [&>div]:!block"
>
{children}
</ScrollAreaPrimitive.Viewport>
Expand Down
Loading