fix(v2): disable default behavior when click on collapsible item (#5161)

This commit is contained in:
Alexey Pyltsyn 2021-07-13 18:13:07 +03:00 committed by GitHub
parent 12faed89db
commit fa9b0cd9c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,7 +128,14 @@ function DocSidebarItemCategory({
'menu__link--active': collapsible && isActive,
[styles.menuLinkText]: !collapsible,
})}
onClick={collapsible ? toggleCollapsed : undefined}
onClick={
collapsible
? (e) => {
e.preventDefault();
toggleCollapsed();
}
: undefined
}
href={collapsible ? '#' : undefined}
{...props}>
{label}