-
Notifications
You must be signed in to change notification settings - Fork 28
Experiment with collapsed ToC categories #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
PlanObservations
Approach
ReasoningWe audited the codebase to confirm Docusaurus v3.6.1, no existing overrides, and the mechanism for feature flags. We inspected the default Category component’s collapse logic and the Proposed File Changes📄 docusaurus.config.ts (MODIFY) 🔗
📁 src/theme/DocSidebarItem/Category (NEW) 🔗
📄 src/theme/DocSidebarItem/Category/index.tsx (NEW) 🔗
DiagramsequenceDiagram
participant Browser
participant CategoryOverride as Category (override)
participant Context as useDocusaurusContext
participant Collapsible as useCollapsible
Browser->>CategoryOverride: Mount each category
CategoryOverride->>Context: Read collapsedTocCategories flag
CategoryOverride->>CategoryOverride: Compute hasActiveChild via isActiveSidebarItem
CategoryOverride->>Collapsible: initialOpen = flag ? hasActiveChild : defaultCollapsed
Collapsible-->>CategoryOverride: Provide open, toggle, props
CategoryOverride-->>Browser: Render collapsed/expanded sidebar UI
Import In IDEDeveloper Humor
💡 TipsSupported Commands (Inside Comments)
Supported Commands (Inside Description)
Community
|
Now that we've reorganized the table of contents categories, I hypothesize that starting out a new visit visit to the docs website will all the categories collapsed (except the one containing the page that you landed on) would make them much easier to navigate, with a lot less cognitive load on the reader.
Let's stage an experiment of this and see how it looks.
The text was updated successfully, but these errors were encountered: