From c3856f698bfe52b21fbaea289f0abe5f64f358f0 Mon Sep 17 00:00:00 2001 From: Suchintan Date: Tue, 17 Feb 2026 23:10:46 -0500 Subject: [PATCH] Fix collapsible nav in collapsed sidebar (#4775) Co-authored-by: Suchintan Singh --- .../src/components/NavLinkGroup.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/skyvern-frontend/src/components/NavLinkGroup.tsx b/skyvern-frontend/src/components/NavLinkGroup.tsx index 91b0dbb8..fbeef800 100644 --- a/skyvern-frontend/src/components/NavLinkGroup.tsx +++ b/skyvern-frontend/src/components/NavLinkGroup.tsx @@ -103,8 +103,7 @@ function NavLinkGroup({ return inputs.includes(match.pathname); }); - const shouldCollapse = - collapsible && !sidebarCollapsed && links.length > initialVisibleCount; + const shouldCollapse = collapsible && links.length > initialVisibleCount; const alwaysVisibleLinks = shouldCollapse ? links.slice(0, initialVisibleCount) : links; @@ -147,7 +146,7 @@ function NavLinkGroup({ ))} {/* Collapsible section */} - {shouldCollapse && !sidebarCollapsed && ( + {shouldCollapse && ( <> {/* Peek item - fades out when collapsed */}
setIsExpanded(!isExpanded)} + aria-label={ + sidebarCollapsed + ? isExpanded + ? "Collapse links" + : `Expand ${hiddenCount} more links` + : undefined + } className={cn( "flex w-full items-center gap-2 rounded-lg py-2 pl-3 text-slate-400 hover:bg-muted hover:text-primary", { "py-1 pl-0 text-[0.8rem]": isMobile }, + { + "justify-center px-3": sidebarCollapsed, + }, )} > - {isExpanded ? "Show less" : `${hiddenCount} more`} + {!sidebarCollapsed && ( + {isExpanded ? "Show less" : `${hiddenCount} more`} + )} )}