Skip to content

Commit ae09434

Browse files
authored
fix: Hide sidebar entries without CSS (#2796)
1 parent b8bb1aa commit ae09434

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/components/sidebarLink.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ export default ({
2222
const location = useLocation();
2323
const isActive = location && location.pathname.indexOf(withPrefix(to)) === 0;
2424

25-
className += " toc-item";
26-
if (isActive || collapsed === false) {
27-
className += " toc-visible";
28-
}
25+
const showSubtree = isActive || collapsed === false;
26+
className += "toc-item";
2927

3028
return (
3129
<li className={className} data-sidebar-branch>
@@ -34,7 +32,7 @@ export default ({
3432
</SmartLink>
3533
{title && children && (
3634
<ul className="list-unstyled" data-sidebar-tree>
37-
{children}
35+
{showSubtree && children}
3836
</ul>
3937
)}
4038
</li>

src/css/_includes/sidebar.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,9 @@
6868
}
6969

7070
[data-sidebar-branch] [data-sidebar-branch] > [data-sidebar-tree] {
71-
display: none;
7271
margin-bottom: 0;
7372
}
7473

75-
[data-sidebar-branch].toc-visible > [data-sidebar-tree] {
76-
display: block;
77-
}
78-
7974
[data-sidebar-link] {
8075
position: relative;
8176
line-height: 1.5;

0 commit comments

Comments
 (0)