Skip to content
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

fix(theme-classic): autocollapse sidebar categories when navigating with paginator #7411

Merged
merged 7 commits into from
May 14, 2022
Merged

fix(theme-classic): autocollapse sidebar categories when navigating with paginator #7411

merged 7 commits into from
May 14, 2022

Conversation

pranabdas
Copy link
Contributor

@pranabdas pranabdas commented May 13, 2022

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: Existing tests should cover the changes.
  • 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

Auto collapse sidebar categories when navigating via paginator. Trying to fix #7387

Test Plan

Test links

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

Related issues/PRs

#7387

Auto collapse sidebar categories when navigating via paginator.
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 13, 2022
@netlify
Copy link

netlify bot commented May 13, 2022

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 33d423c
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/627f36c7f9e87900099a9eb1
😎 Deploy Preview https://deploy-preview-7411--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 site settings.

@github-actions
Copy link

github-actions bot commented May 13, 2022

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 71 🟢 100 🟢 100 🟢 100 🟢 90 Report
/docs/installation 🟠 76 🟢 99 🟢 100 🟢 100 🟢 90 Report

Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! The paginator navigation issue seems resolved, but now, when you are in a category: https://deploy-preview-7411--docusaurus-2.netlify.app/docs/advanced/plugins/, the entire category (Advanced Guides) is not collapsible, which seems like bad UX to me. Could you take a look?

@pranabdas
Copy link
Contributor Author

@Josh-Cena Collapse button should be fine now, however one unintended change I see, if we click on non-category item it collapses previously opened category which used to be open prior to this change.

@Josh-Cena
Copy link
Collaborator

if we click on non-category item it collapses previously opened category

I noticed that as well. If you can manage to fix it it would be neat, otherwise I'll take a look later

@Josh-Cena Josh-Cena added the pr: bug fix This PR fixes a bug in a past release. label May 13, 2022
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented May 13, 2022

Actually, it's because the fix is going in the wrong direction. We have two way to uncollapse a category: the "imperative" way through setCollapsed, and the "reactive" way through updateCollapsed, which also informs other categories to collapse themselves. You should pass the latter into useAutoExpandActiveCategory instead. It may cause other problems like messing with the initial collapse state, but that's the idea.

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
@pranabdas
Copy link
Contributor Author

@Josh-Cena now the behaviour seems correct.

@Josh-Cena Josh-Cena changed the title fix: autocollapse sidebar categories fix(theme-classic): autocollapse sidebar categories when navigating with paginator May 14, 2022
Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

Thanks!

Easier than I thought 😄

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.

Sidebar categories don't autocollapse when navigating via paginator
3 participants