Skip to content

Make sidebar nav groups with landing pages collapsible and fix mobile drawer closing on expand#786

Merged
TechHutTV merged 2 commits into
mainfrom
fix/collapsible-nav-groups
Jun 12, 2026
Merged

Make sidebar nav groups with landing pages collapsible and fix mobile drawer closing on expand#786
TechHutTV merged 2 commits into
mainfrom
fix/collapsible-nav-groups

Conversation

@TechHutTV

@TechHutTV TechHutTV commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Sidebar items that have both a landing page and child links previously rendered as plain links with their sub pages always expanded, and the isOpen: false was ignored. These items now render as collapsible groups and clicking the title navigates to the landing page. This also fixes a mobile bug where tapping a chevron to expand a group closed the entire nav drawer.

Changes

  • Items in docsNavigation with a links array now render as NavigationGroup instead of an always-expanded NavLink, so groups with their own href are collapsible.
  • For groups with an href, the title click navigates to the landing page (opening the group if closed) and on click it toggles collapse without navigating.
  • An explicit isOpen: false in the navigation data is now respected,
  • Groups auto-open when the current page is their landing page or any descendant, so deep links still reveal the active page, and the group title gets active styling on its landing page.
  • On mobile, expanding a group no longer auto-navigates (via useIsInsideMobileNavigation), which previously fired routeChangeStart and closed the drawer.
  • Removed docs/integrations/identity-providers/self-hosted/, two orphaned Docusaurus-era files.

Summary by CodeRabbit

  • Documentation

    • Removed Azure AD self-hosted integration guide
    • Removed Zitadel self-hosted integration guide
  • User Interface

    • Improved documentation navigation with refined expand/collapse and chevron behavior
    • Enhanced active highlighting and navigation flows for mobile and desktop
    • Adjusted initial open state for a docs group to improve discoverability

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c080e979-d42d-4171-9524-a4ebb3506201

📥 Commits

Reviewing files that changed from the base of the PR and between 31aacfd and 6962333.

📒 Files selected for processing (1)
  • src/components/NavigationDocs.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/NavigationDocs.jsx

📝 Walkthrough

Walkthrough

NavigationDocs.jsx refactors navigation component behavior to support mobile-aware group expansion, href-based header navigation, independent chevron control, and explicit nested link rendering. Two integration guide files (Azure AD and Zitadel) are removed.

Changes

Navigation Component & Documentation Cleanup

Layer / File(s) Summary
Mobile Navigation Context & Navigation Data Setup
src/components/NavigationDocs.jsx
Hook import useIsInsideMobileNavigation enables branch behavior based on mobile-nav context. Static navigation data: one "GET STARTED" group changes isOpen from true to false.
Active Group Detection & Initial Open State
src/components/NavigationDocs.jsx
NavigationGroup computes isActiveGroup by matching router pathname against group href and descendants, then initializes isOpen using group.isOpen ?? !hasChildren with forced-open override when active.
Header Click Navigation & Toggle Logic
src/components/NavigationDocs.jsx
Header click handler branches: groups with href navigate and force expansion; groups without href toggle isOpen with highlight/navigation logic adjusted based on active state and mobile-nav context.
Independent Chevron Expansion Handler
src/components/NavigationDocs.jsx
Chevron refactored into clickable span with propagation/default prevention, toggles isOpen independently, and updates active highlight differently when opening vs. closing.
Nested Item Rendering & Link Hierarchy
src/components/NavigationDocs.jsx
Children rendering explicitly branches: nested links render recursive NavigationGroup; leaf items render NavLink directly without nested links props.
Removed Integration Guides
docs/integrations/identity-providers/self-hosted/azure-ad.md, docs/integrations/identity-providers/self-hosted/zitadel.md
Azure AD and Zitadel integration guide documents completely removed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • SunsetDrifter
  • braginini

Poem

🐰 The docs hop along with grace,
Navigation finds its rightful place,
Headers click, chevrons dance apart,
Mobile knows the mobile heart,
Groups expand where needed true,
Old guides fade, the new shines through! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: making sidebar nav groups with landing pages collapsible and fixing mobile drawer closing behavior on expand—both central objectives of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/collapsible-nav-groups

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/components/NavigationDocs.jsx (1)

974-989: 💤 Low value

Consider guarding router.push to avoid redundant navigation.

Line 977 calls router.push(group.href) unconditionally, even when router.pathname === group.href. This triggers a redundant navigation when clicking the header of the group you're already on.

Consider wrapping it in a conditional:

🔧 Proposed optimization
         onClick={() => {
           if (group.href) {
             if (!isOpen) setIsOpen(true)
-            router.push(group.href)
+            if (router.pathname !== group.href) {
+              router.push(group.href)
+            }
             setActiveHighlight()
             return
           }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/NavigationDocs.jsx` around lines 974 - 989, The onClick
handler calls router.push(group.href) unconditionally which can trigger
redundant navigation; update the handler in the NavigationDocs component to
check the current route before pushing (e.g., compare router.pathname or
router.asPath to group.href) and only call router.push(group.href) when they
differ, preserving the existing setIsOpen and setActiveHighlight logic and all
other conditions (references: router.push, router.pathname/router.asPath,
group.href, isOpen, setIsOpen, setActiveHighlight, isActiveGroup,
isInsideMobileNavigation, group.links).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/NavigationDocs.jsx`:
- Around line 1058-1074: The key for the nested NavigationGroup is unstable
because it includes isOpen (key={link.title + isOpen}), causing remounts and
state loss; change the key to a stable identifier (for example use link.href or
link.id or link.title alone) so NavigationGroup retains its identity across
parent toggles—update the JSX that renders <NavigationGroup ... key={...} /> to
remove isOpen from the key and use a permanent unique property on link instead.
- Around line 954-961: The component initializes isOpen with useState but never
updates it on route changes, so groups containing the active route can remain
collapsed; add a useEffect (import useEffect from React) that depends on
[router.pathname, isActiveGroup] and calls setIsOpen(true) when isActiveGroup
becomes true (you can leave collapse behaviour unchanged so it only auto-opens
groups that contain the current route). Locate the isActiveGroup computation and
the isOpen/setIsOpen state (symbols: isActiveGroup, isOpen, setIsOpen,
findActiveGroupIndex, router.pathname) and implement the effect there to
synchronize expansion with navigation.

---

Nitpick comments:
In `@src/components/NavigationDocs.jsx`:
- Around line 974-989: The onClick handler calls router.push(group.href)
unconditionally which can trigger redundant navigation; update the handler in
the NavigationDocs component to check the current route before pushing (e.g.,
compare router.pathname or router.asPath to group.href) and only call
router.push(group.href) when they differ, preserving the existing setIsOpen and
setActiveHighlight logic and all other conditions (references: router.push,
router.pathname/router.asPath, group.href, isOpen, setIsOpen,
setActiveHighlight, isActiveGroup, isInsideMobileNavigation, group.links).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c4018db8-2ae1-47fc-b592-138a3ae86aee

📥 Commits

Reviewing files that changed from the base of the PR and between 39303d1 and 31aacfd.

📒 Files selected for processing (3)
  • docs/integrations/identity-providers/self-hosted/azure-ad.md
  • docs/integrations/identity-providers/self-hosted/zitadel.md
  • src/components/NavigationDocs.jsx
💤 Files with no reviewable changes (2)
  • docs/integrations/identity-providers/self-hosted/zitadel.md
  • docs/integrations/identity-providers/self-hosted/azure-ad.md

Comment thread src/components/NavigationDocs.jsx
Comment thread src/components/NavigationDocs.jsx
@TechHutTV TechHutTV merged commit 9cf8498 into main Jun 12, 2026
3 checks passed
@TechHutTV TechHutTV deleted the fix/collapsible-nav-groups branch June 12, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants