Skip to content

Conversation

@qqq614
Copy link
Contributor

@qqq614 qqq614 commented Jul 19, 2025

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

  • As i have mentioned in the issue DocSidebarItemCategory doesn't expand upon active menu changes under it #11122, currently docsidebarItem/Category doesn't expand when the user navigates to the menu under the same category(when it's in collapsed state). It only expands when the user navigates to the menu in not active category.
  • This behavior is due to the useAutoExpandActiveCategory function in DocsidebarItem/Category in theme-classic. Currently DocSidebarItemCategory only expand itself when it changes from inactive to active, not when it is already active but the url path changes.
  • This not only affects when the user navigates to the menu under the active category by clicking markdown link, but also when the user searches menu through algolia and clicks on the result to navigate to that page(as stressed in the issue).

Test Plan

  1. Weirdly when i included the dogfooding page, it gave the broken link error in netlify, so instead, theres another way to test this.
  2. https://deploy-preview-11338--docusaurus-2.netlify.app/tests/docs/tests/category-links/no-index-doc/sample-doc/
  3. Here collapse the no-index-doc category on the sidebar and on the sample doc page, go to previous page. You can see that now the collapsed catogory unfolds.
    (which is different from https://docusaurus.io/tests/docs/tests/category-links/no-index-doc/sample-doc)

local dogfooding test

I tested the dogfooding locally and this is the behavior.

Before

2025-07-20.12.55.48.mov

After

2025-07-20.12.33.22.mov

Test links

Deploy Preview:
https://deploy-preview-11338--docusaurus-2.netlify.app/

Related issues/PRs

#11122

…to same menu under already active category.
@qqq614 qqq614 requested review from Josh-Cena and slorber as code owners July 19, 2025 16:16
@meta-cla
Copy link

meta-cla bot commented Jul 19, 2025

Hi @qqq614!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@github-actions
Copy link

github-actions bot commented Jul 19, 2025

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🔴 40 🟢 98 🟢 100 🟢 100 Report
/docs/installation 🟠 51 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 69 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 58 🟢 96 🟢 100 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 57 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 60 🟢 96 🟢 100 🟠 86 Report
/blog/tags 🟠 68 🟢 100 🟢 100 🟠 86 Report

@meta-cla meta-cla bot added the CLA Signed Signed Facebook CLA label Jul 19, 2025
@meta-cla
Copy link

meta-cla bot commented Jul 19, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@netlify
Copy link

netlify bot commented Jul 19, 2025

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 069c7cc
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/687bd96fd444f30008e48e42
😎 Deploy Preview https://deploy-preview-11338--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@slorber
Copy link
Collaborator

slorber commented Jul 24, 2025

perfect thanks 👍

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Jul 24, 2025
@slorber slorber linked an issue Jul 24, 2025 that may be closed by this pull request
7 tasks
@slorber slorber changed the title fix(theme-classic): fix that category doesn't expand upon navigating to some menu under already active category. fix(theme-classic): fix collapsed sidebar category expansion when navigating to another link within that category Jul 24, 2025
@slorber slorber merged commit 12bcad9 into facebook:main Jul 24, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DocSidebarItemCategory doesn't expand upon active menu changes under it

2 participants