Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Address cluade-bot comments

Carlos Monastyrski57caabea4989
diff --git a/frontend/src/components/v3/generic/Sidebar/Sidebar.tsx b/frontend/src/components/v3/generic/Sidebar/Sidebar.tsx
index 8cffcd5657..9221425ebe 100644
--- a/frontend/src/components/v3/generic/Sidebar/Sidebar.tsx
+++ b/frontend/src/components/v3/generic/Sidebar/Sidebar.tsx
@@ -525,6 +525,13 @@ function SidebarCollapsibleGroup({
const [isOpen, setIsOpen] = React.useState(defaultOpen);
const { state, isMobile } = useSidebar();
const isCollapsed = state === "collapsed" && !isMobile;
+ const contentRef = React.useRef<HTMLDivElement>(null);
+
+ React.useEffect(() => {
+ if (isOpen || isCollapsed) return;
+ const hasActiveChild = contentRef.current?.querySelector('[data-active="true"]');
+ if (hasActiveChild) setIsOpen(true);
+ });
const abbreviation =
collapsedLabel ||
@@ -569,12 +576,16 @@ function SidebarCollapsibleGroup({
</button>
)}
<div
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ {...(!isCollapsed && !isOpen ? { inert: "" as any } : {})}
className={cn(
"grid transition-[grid-template-rows,opacity] duration-200 ease-in-out",
isCollapsed || isOpen ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
)}
>
- <div className="overflow-hidden">{children}</div>
+ <div ref={contentRef} className="overflow-hidden">
+ {children}
+ </div>
</div>
</SidebarGroup>
);
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx
index 7a3478022a..dcc5aa4d49 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx
@@ -99,7 +99,8 @@ export const CertManagerNav = ({
icon: PenTool,
pathSuffix: "code-signing",
activeMatch: /\/code-signing/,
- search: { selectedTab: "signers" }
+ search: { selectedTab: "signers" },
+ isDefaultSearch: true
},
{
label: "Signing Requests",
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNavLink.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNavLink.tsx
index 63618364bd..c848ba6ac8 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNavLink.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNavLink.tsx
@@ -28,9 +28,10 @@ export const ProjectNavLink = ({
const pathMatch = pathname.startsWith(fullPath) || Boolean(item.activeMatch?.test(pathname));
const isActive = item.search
? pathMatch &&
- Object.entries(item.search).every(
- ([key, value]) => (locationSearch as Record<string, unknown>)?.[key] === value
- )
+ Object.entries(item.search).every(([key, value]) => {
+ const urlValue = (locationSearch as Record<string, unknown>)?.[key];
+ return urlValue === value || (urlValue === undefined && item.isDefaultSearch);
+ })
: pathMatch;
if (item.submenu && onSubmenuOpen) {
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/types.ts b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/types.ts
index 89e634caca..181d781cbe 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/types.ts
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/types.ts
@@ -40,6 +40,8 @@ export type NavItem = {
permissionCheck?: boolean;
/** Query params to append to the link and use for active state matching */
search?: Record<string, string>;
+ /** When true, this item is also active when the path matches but search keys are absent from the URL */
+ isDefaultSearch?: boolean;
};
export type OrgNavItem = {