From 9f3da13f3588ee74dc82087aafcd461fb55758e0 Mon Sep 17 00:00:00 2001 From: DAK <40970507+dakahn@users.noreply.github.com> Date: Fri, 29 Oct 2021 11:30:27 -0500 Subject: [PATCH] fix(UIShell): expand check so side nav items close properly (#9976) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/react/src/components/UIShell/SideNav.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/UIShell/SideNav.js b/packages/react/src/components/UIShell/SideNav.js index 7f2f4bacb0b0..8c8ade147b3b 100644 --- a/packages/react/src/components/UIShell/SideNav.js +++ b/packages/react/src/components/UIShell/SideNav.js @@ -90,7 +90,9 @@ const SideNav = React.forwardRef(function SideNav(props, ref) { : expanded; // avoid spreading `isSideNavExpanded` to non-Carbon UI Shell children return React.cloneElement(child, { - ...(CARBON_SIDENAV_ITEMS.includes(child.type?.displayName) + ...(CARBON_SIDENAV_ITEMS.includes( + child.type?.displayName ?? child.type?.name + ) ? { isSideNavExpanded: currentExpansionState, }