fix(theme): fix unability to navigate to category's page when browsing its children items (#11242)

This commit is contained in:
Sébastien Lorber 2025-06-05 18:13:46 +02:00 committed by GitHub
parent d3ab0e63a0
commit 60df4936aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,7 +188,11 @@ export default function DocSidebarItemCategory({
? (e) => {
onItemClick?.(item);
if (href) {
if (isActive) {
// When already on the category's page, we collapse it
// We don't use "isActive" because it would collapse the
// category even when we browse a children element
// See https://github.com/facebook/docusaurus/issues/11213
if (isCurrentPage) {
e.preventDefault();
updateCollapsed();
} else {