Skip to content

Commit 60df493

Browse files
authored
fix(theme): fix unability to navigate to category's page when browsing its children items (#11242)
1 parent d3ab0e6 commit 60df493

File tree

1 file changed

+5
-1
lines changed
  • packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category

1 file changed

+5
-1
lines changed

packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ export default function DocSidebarItemCategory({
188188
? (e) => {
189189
onItemClick?.(item);
190190
if (href) {
191-
if (isActive) {
191+
// When already on the category's page, we collapse it
192+
// We don't use "isActive" because it would collapse the
193+
// category even when we browse a children element
194+
// See https://github.com/facebook/docusaurus/issues/11213
195+
if (isCurrentPage) {
192196
e.preventDefault();
193197
updateCollapsed();
194198
} else {

0 commit comments

Comments
 (0)