-
-
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
fix: make proper highlighting doc link if no sidebar #5317
fix: make proper highlighting doc link if no sidebar #5317
Conversation
Close All navbar items without sidebar are active facebook#5310
✔️ [V2] 🔨 Explore the source changes: c113b0c 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/610ef6e9e2a8670008358b62 😎 Browse the preview: https://deploy-preview-5317--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5317--docusaurus-2.netlify.app/ |
packages/docusaurus-theme-classic/src/theme/NavbarItem/DocNavbarItem.tsx
Outdated
Show resolved
Hide resolved
…arItem.tsx Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
@@ -56,7 +56,7 @@ export default function DocNavbarItem({ | |||
{...props} | |||
className={clsx(props.className, { | |||
[activeDocInfimaClassName]: | |||
activeDoc && activeDoc.sidebar === doc.sidebar, | |||
activeDoc?.sidebar && activeDoc.sidebar === doc.sidebar, |
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.
in this case navbar items without sidebar always will be inactive?
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.
No it would work fine because it's already the default behavior for a link to be active when we are on the link target page. We only need this additional class to enable the "tab-like" behavior.
👍 |
Motivation
Closes #5310
Have you read the Contributing Guidelines on pull requests?
(Write your answer here.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
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.)