Skip to content

Commit 5b5fefc

Browse files
committed
Fix global scroll area overflow: add opt-in overflowX prop
Revert the default viewport overflow from 'overflow-auto' back to 'overflow-y-auto' so existing ScrollArea consumers don't get unexpected horizontal scrollbars. Add an 'overflowX' prop that components can use to opt into horizontal scrolling when needed (used by KeybindingsSettings for its wide table).
1 parent 19e5d52 commit 5b5fefc

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

apps/web/src/components/settings/KeybindingsSettings.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ export function KeybindingsSettingsPanel() {
981981

982982
<ScrollArea
983983
chainVerticalScroll
984+
overflowX
984985
scrollFade
985986
hideScrollbars
986987
className="w-full max-w-full rounded-none"

apps/web/src/components/ui/scroll-area.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ function ScrollArea({
1111
scrollbarGutter = false,
1212
hideScrollbars = false,
1313
chainVerticalScroll = false,
14+
overflowX = false,
1415
...props
1516
}: ScrollAreaPrimitive.Root.Props & {
1617
scrollFade?: boolean;
1718
scrollbarGutter?: boolean;
1819
hideScrollbars?: boolean;
1920
chainVerticalScroll?: boolean;
21+
overflowX?: boolean;
2022
}) {
2123
return (
2224
<ScrollAreaPrimitive.Root
@@ -25,7 +27,8 @@ function ScrollArea({
2527
>
2628
<ScrollAreaPrimitive.Viewport
2729
className={cn(
28-
"h-full max-h-[inherit] overflow-auto overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain",
30+
"h-full max-h-[inherit] overflow-y-auto overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain",
31+
overflowX && "overflow-x-auto",
2932
chainVerticalScroll && "overscroll-y-auto",
3033
scrollFade &&
3134
"mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",

0 commit comments

Comments
 (0)