diff --git a/packages/@vuepress/theme-default/components/SidebarLinks.vue b/packages/@vuepress/theme-default/components/SidebarLinks.vue index ea084e25c4..55e62885eb 100644 --- a/packages/@vuepress/theme-default/components/SidebarLinks.vue +++ b/packages/@vuepress/theme-default/components/SidebarLinks.vue @@ -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 }