Skip to content

Commit

Permalink
fix($default-theme): sidebar groups are not opened when directly navi…
Browse files Browse the repository at this point in the history
…gating to these pages (fix #2564) (#2565)
  • Loading branch information
echojoshchen authored Feb 18, 2021
1 parent e79c8b7 commit 3ab9fca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/@vuepress/theme-default/components/SidebarLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ function resolveOpenGroupIndex (route, items) {
function descendantIsActive (route, item) {
if (item.type === 'group') {
return item.children.some(child => {
const childIsActive = item.path && isActive(route, item.path)
const grandChildIsActive = item.children.some(child => {
if (child.type === 'group') {
return descendantIsActive(route, child)
} else {
return child.type === 'page' && isActive(route, child.path)
}
})
return childIsActive || grandChildIsActive
}
return false
}
Expand Down

0 comments on commit 3ab9fca

Please sign in to comment.