File tree Expand file tree Collapse file tree
apps/desktop/src/app/shell Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ export function AppSidebar({
238238
239239 { /* Brain — collapsible */ }
240240 < Collapsible
241- defaultOpen = { activeView === "brain" }
241+ open = { activeView === "brain" }
242242 asChild
243243 className = "group/collapsible"
244244 >
Original file line number Diff line number Diff line change @@ -68,4 +68,16 @@ describe("Sidebar Brain sub-navigation", () => {
6868 // The sidebar should use sidebar- prefixed tokens which adapt to theme
6969 expect ( sidebarSrc ) . toMatch ( / s i d e b a r - a c c e n t | s i d e b a r - f o r e g r o u n d | s i d e b a r - p r i m a r y / ) ;
7070 } ) ;
71+
72+ // AC6: Brain sub-menu collapses when navigating away from Brain page
73+ it ( "uses controlled open prop derived from activeView, not defaultOpen" , ( ) => {
74+ // The Collapsible wrapping the Brain section must use the controlled `open`
75+ // prop so that expand/collapse state tracks the current route, collapsing
76+ // when the user navigates away from Brain pages.
77+ // It should NOT use defaultOpen (which only sets initial state and then
78+ // Radix manages it internally, causing the menu to stay open on all pages).
79+ expect ( sidebarSrc ) . toMatch ( / o p e n = \{ a c t i v e V i e w \s * = = = \s * [ " ' ] b r a i n [ " ' ] \} / ) ;
80+ // Ensure defaultOpen is NOT used for the Brain collapsible
81+ expect ( sidebarSrc ) . not . toMatch ( / d e f a u l t O p e n = \{ a c t i v e V i e w \s * = = = \s * [ " ' ] b r a i n [ " ' ] \} / ) ;
82+ } ) ;
7183} ) ;
You can’t perform that action at this time.
0 commit comments