ECHOES-1448 Auto-open SidebarNavigation accordions when a child item becomes active - #749
Conversation
✅ Deploy Preview for echoes-react ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR enhances the Layout.SidebarNavigation.AccordionItem (uncontrolled mode) so it automatically opens when one of its child items becomes active (via routing match or explicit isActive). It introduces an opt-out prop to preserve the previous “stay closed unless user opens it” behavior when needed.
Changes:
- Added auto-open-on-active-child behavior for uncontrolled
SidebarNavigationAccordionItem, with an opt-out viadisableAutoOpenOnActiveItem. - Introduced an internal
SidebarNavigationAccordionContextso child items can report active-state changes to the parent accordion. - Updated
SidebarNavigationAccordionChildItemand expanded test + Storybook coverage for route-driven and explicit active states.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| stories/layout/sidebar-navigation/SidebarNavigationAccordionItem-stories.tsx | Adds Storybook examples for auto-open and opt-out behavior. |
| src/components/layout/sidebar-navigation/SidebarNavigationAccordionItem.tsx | Implements uncontrolled auto-open logic and provides the context handler to children. |
| src/components/layout/sidebar-navigation/SidebarNavigationAccordionContext.ts | New internal context to propagate child “auto-open key” changes to the accordion. |
| src/components/layout/sidebar-navigation/SidebarNavigationAccordionChildItem.tsx | Reports active/route-match changes to the accordion when context is present. |
| src/components/layout/sidebar-navigation/index.ts | Re-exports child item props and documents the new uncontrolled auto-open behavior. |
| src/components/layout/sidebar-navigation/tests/SidebarNavigationAccordionItem-test.tsx | Adds coverage for auto-open, opt-out, controlled behavior, and navigation-driven state transitions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
080a0b0 to
19680b5
Compare
9357280 to
a646b06
Compare
5a6652f to
6a2bf8a
Compare
jeremy-davis-sonarsource
left a comment
There was a problem hiding this comment.
I wonder if we can't make it a bit easier to follow by extracting more parts in a hook (or the context, even?)
a8f6195 to
6ffe70a
Compare
I've introduced a hook for the parent item, it didn't seem worth it for the child |
6ffe70a to
2a725fd
Compare
This comment was marked as outdated.
This comment was marked as outdated.
2a725fd to
41ae718
Compare
41ae718 to
8479c18
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
jeremy-davis-sonarsource
left a comment
There was a problem hiding this comment.
Looks great!




Summary
SidebarNavigation.AccordionItemisActiveon accordion child items