diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx index 8890a8043d2b8..c42de4e093f57 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx @@ -101,6 +101,7 @@ function CollapseButton({ {label: categoryLabel}, ) } + aria-expanded={!collapsed} type="button" className="clean-btn menu__caret" onClick={onClick} @@ -193,8 +194,9 @@ export default function DocSidebarItemCategory({ } } aria-current={isCurrentPage ? 'page' : undefined} - aria-expanded={collapsible ? !collapsed : undefined} href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback} + aria-expanded={collapsible && !href ? !collapsed : undefined} + role={collapsible && !href ? 'button' : undefined} {...props}> {label}