-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
feat(v2): add option to toggle sidebar category open by default #2613
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 6c6f420 |
The following tests are failing:
Any guidance on how to fix these would be awesome! |
Additional suggestions (out of the scope of this work):
yarn swizzle @docusaurus/theme-classic DocSidebar |
@jsjoeio if I understand correctly, you just need to update snapshots, run |
That worked for the snapshot tests! Now I just have to fix the actual test that I broke 😂 Thank you @lex111 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Joe!
@jsjoeio We should also update the docs to tell people about this cool new feature :) |
@yangshun Oh no! Okay. Do you want me to do that? (i.e. open a new PR with this work?) |
This PR adds the ability to toggle sidebar categories open by default.
Changes
item.collapsed
if necessaryMotivation
Fixes #2354
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
I wrote extensive notes on the issue: #2354
Here's how I tested my changes:
yarn build
verdaccio
locally:yarn lerna publish --registry http://localhost:4873 --no-git-tag-version
sidebars.js
file:false
in thesidebars.js
file.Screenshots
Here are a few other screenshots of it in action:
Before
This is what happens before I made any changes. (note: I load the page, "Powering MDX" is collapsed).
After
I made the change and now it loads and is expanded (not collapsed) like I want!
And, if I'm on the "Powering MDX", it should be expanded (because it's the current page), which still works as expected.
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)