Skip to content

Commit e9808e2

Browse files
bchapuisclaude
andcommitted
Fix collapsed sidebar intercepting clicks and scrolling horizontally
The invisible SidebarGroupLabel (opacity-0 + -mt-8) was overlapping the last icon of the preceding group and intercepting pointer events, making some icons unclickable. Also constrained SidebarContent to vertical scroll only and hide nav item labels via CSS when collapsed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ad51283 commit e9808e2

5 files changed

Lines changed: 13 additions & 30 deletions

File tree

apps/app/src/components/sidebar/nav-main.tsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
SidebarMenuItem,
1212
useSidebar,
1313
} from "@/components/ui/sidebar";
14-
import { cn } from "@/utils/utils";
1514

1615
import { NavLink } from "../nav-link";
1716

@@ -45,7 +44,7 @@ const NAV_ITEM_TOUR_MAP: Record<string, string> = {
4544
Billing: "billing-nav",
4645
};
4746

48-
function NavMainItem({ item, open }: { item: NavMainItem; open: boolean }) {
47+
function NavMainItem({ item }: { item: NavMainItem }) {
4948
const dataTour = NAV_ITEM_TOUR_MAP[item.title];
5049

5150
return (
@@ -58,16 +57,11 @@ function NavMainItem({ item, open }: { item: NavMainItem; open: boolean }) {
5857
<NavLink
5958
to={item.url}
6059
end={item.end}
61-
className="whitespace-nowrap"
60+
className="overflow-hidden whitespace-nowrap"
6261
activeClassName="[&>span]:text-foreground! bg-neutral-300/50 dark:bg-neutral-600/50 hover:bg-neutral-300/50 dark:hover:bg-neutral-600/50 focus:bg-neutral-300/50 dark:focus:bg-neutral-600/50 active:bg-neutral-300/50 dark:active:bg-neutral-600/50"
6362
>
6463
{item.icon && <item.icon />}
65-
<span
66-
className={cn(
67-
"text-sm transition-opacity text-neutral-600 dark:text-neutral-400",
68-
open ? "opacity-100" : "opacity-0"
69-
)}
70-
>
64+
<span className="text-sm text-neutral-600 dark:text-neutral-400 group-data-[collapsible=icon]:hidden">
7165
{item.title}
7266
</span>
7367
</NavLink>
@@ -103,7 +97,7 @@ export function NavMain({ groups, footerItems }: NavMainProps) {
10397
)}
10498
<SidebarMenu className="bg-transparent">
10599
{group.items.map((item) => (
106-
<NavMainItem key={item.title} item={item} open={open} />
100+
<NavMainItem key={item.title} item={item} />
107101
))}
108102
</SidebarMenu>
109103
</SidebarGroup>
@@ -113,21 +107,16 @@ export function NavMain({ groups, footerItems }: NavMainProps) {
113107
<SidebarMenu className="bg-transparent px-4">
114108
{footerItems &&
115109
footerItems.map((item) => (
116-
<NavMainItem key={item.title} item={item} open={open} />
110+
<NavMainItem key={item.title} item={item} />
117111
))}
118112
<SidebarMenuItem>
119113
<SidebarMenuButton
120114
tooltip="Toggle sidebar"
121115
onClick={toggleSidebar}
122-
className="hover:bg-neutral-200/50 dark:hover:bg-neutral-800/50 transition-colors mt-1 mb-5"
116+
className="hover:bg-neutral-200/50 dark:hover:bg-neutral-800/50 transition-colors mt-1 mb-5 overflow-hidden whitespace-nowrap"
123117
>
124118
{open ? <PanelLeftClose /> : <PanelLeftOpen />}
125-
<span
126-
className={cn(
127-
"uppercase text-semibold text-xs transition-opacity",
128-
open ? "opacity-100" : "opacity-0"
129-
)}
130-
>
119+
<span className="uppercase text-semibold text-xs group-data-[collapsible=icon]:hidden">
131120
Collapse
132121
</span>
133122
</SidebarMenuButton>

apps/app/src/components/ui/sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ const SidebarContent = React.forwardRef<
386386
ref={ref}
387387
data-sidebar="content"
388388
className={cn(
389-
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto",
389+
"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden",
390390
className
391391
)}
392392
{...props}
@@ -422,7 +422,7 @@ const SidebarGroupLabel = React.forwardRef<
422422
data-sidebar="group-label"
423423
className={cn(
424424
"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-hidden ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
425-
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
425+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 group-data-[collapsible=icon]:pointer-events-none",
426426
className
427427
)}
428428
{...props}

apps/app/src/components/workflow/fields/document-field.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function DocumentField({
6767
"relative rounded-md overflow-hidden border",
6868
disabled && "bg-muted/50 border-border",
6969
!disabled &&
70-
"bg-background border-neutral-300 dark:border-neutral-700",
70+
"bg-background border-neutral-300 dark:border-neutral-700",
7171
className
7272
)}
7373
>
@@ -83,7 +83,7 @@ export function DocumentField({
8383
"relative rounded-md overflow-hidden border",
8484
disabled && "bg-muted/50 border-border",
8585
!disabled &&
86-
"bg-background border-neutral-300 dark:border-neutral-700",
86+
"bg-background border-neutral-300 dark:border-neutral-700",
8787
className
8888
)}
8989
>

apps/app/src/pages/playground-page.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ export function PlaygroundPage() {
9393
};
9494

9595
return (
96-
<InsetLayout
97-
title="Playground"
98-
childrenClassName="flex flex-col h-full"
99-
>
96+
<InsetLayout title="Playground" childrenClassName="flex flex-col h-full">
10097
<div className="flex flex-col gap-4 min-h-0 flex-1">
10198
{/* Search */}
10299
<div className="relative shrink-0">

apps/app/src/pages/templates-page.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ export function TemplatesPage() {
119119
}
120120

121121
return (
122-
<InsetLayout
123-
title="Templates"
124-
childrenClassName="flex flex-col h-full"
125-
>
122+
<InsetLayout title="Templates" childrenClassName="flex flex-col h-full">
126123
<div className="flex flex-col gap-4 min-h-0 flex-1">
127124
{/* Search */}
128125
<div className="relative shrink-0">

0 commit comments

Comments
 (0)