Skip to content

Commit 3ab9fca

Browse files
authored
fix($default-theme): sidebar groups are not opened when directly navigating to these pages (fix #2564) (#2565)
1 parent e79c8b7 commit 3ab9fca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/@vuepress/theme-default/components/SidebarLinks.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,16 @@ function resolveOpenGroupIndex (route, items) {
9090
9191
function descendantIsActive (route, item) {
9292
if (item.type === 'group') {
93-
return item.children.some(child => {
93+
const childIsActive = item.path && isActive(route, item.path)
94+
const grandChildIsActive = item.children.some(child => {
9495
if (child.type === 'group') {
9596
return descendantIsActive(route, child)
9697
} else {
9798
return child.type === 'page' && isActive(route, child.path)
9899
}
99100
})
101+
102+
return childIsActive || grandChildIsActive
100103
}
101104
return false
102105
}

0 commit comments

Comments
 (0)