diff --git a/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx b/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx index de1de266a0..4be84b641d 100644 --- a/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx +++ b/packages/docusaurus-theme-common/src/components/Collapsible/index.tsx @@ -197,21 +197,8 @@ function CollapsibleBase({ return; } - const el = collapsibleRef.current!; - const currentCollapsibleElementHeight = el.style.height; - - if ( - !collapsed && - parseInt(currentCollapsibleElementHeight, 10) === el.scrollHeight - ) { - applyCollapsedStyle(el, false); - onCollapseTransitionEnd?.(false); - } - - if (currentCollapsibleElementHeight === CollapsedStyles.height) { - applyCollapsedStyle(el, true); - onCollapseTransitionEnd?.(true); - } + applyCollapsedStyle(collapsibleRef.current!, collapsed); + onCollapseTransitionEnd?.(collapsed); }} className={className}> {children} diff --git a/website/_dogfooding/docs-tests-sidebars.js b/website/_dogfooding/docs-tests-sidebars.js index 6305fe410b..61fdaa1f23 100644 --- a/website/_dogfooding/docs-tests-sidebars.js +++ b/website/_dogfooding/docs-tests-sidebars.js @@ -22,7 +22,16 @@ module.exports = { { type: 'category', label: 'Huge sidebar category', - items: generateHugeSidebarItems(4), + items: [ + ...[ + { + type: 'link', + href: '/', + label: 'Test Test test test test test test', + }, + ], + ...generateHugeSidebarItems(4), + ], }, { type: 'link', @@ -46,8 +55,8 @@ module.exports = { function generateHugeSidebarItems() { const maxLevel = 4; - const linksCount = 5; - const categoriesCount = 5; + const linksCount = 8; + const categoriesCount = 8; function generateRecursive(maxLevel, currentLevel = 0) { if (currentLevel === maxLevel) {