Skip to content

Commit 128c5f3

Browse files
committed
fix(ui): submenu should include active item when change color of expand
1 parent ccf5e3e commit 128c5f3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/ui/src/components/menu/Menu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ function Menu<ID extends DId, T extends DMenuItem<ID>>(props: DMenuProps<ID, T>,
422422
dMode={dMode}
423423
dInNav={inNav}
424424
dActive={(dMode === 'vertical' ? !isExpand : isUndefined(popupState)) && activeIds.includes(itemId)}
425+
dIncludeActive={activeIds.includes(itemId)}
425426
dExpand={isExpand}
426427
dEmpty={isEmpty}
427428
dFocusVisible={focusVisible && isFocus}

packages/ui/src/components/menu/Sub.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface DSubProps {
2727
dMode: DMenuMode;
2828
dInNav: boolean;
2929
dActive: boolean;
30+
dIncludeActive: boolean;
3031
dExpand: boolean;
3132
dEmpty: boolean;
3233
dFocusVisible: boolean;
@@ -50,6 +51,7 @@ function Sub(props: DSubProps, ref: React.ForwardedRef<() => void>): JSX.Element
5051
dMode,
5152
dInNav,
5253
dActive,
54+
dIncludeActive,
5355
dExpand,
5456
dEmpty,
5557
dFocusVisible,
@@ -145,7 +147,7 @@ function Sub(props: DSubProps, ref: React.ForwardedRef<() => void>): JSX.Element
145147
[`${dPrefix}menu__item--horizontal`]: inHorizontalNav,
146148
[`${dPrefix}menu__item--icon`]: iconMode,
147149
'is-active': dActive,
148-
'is-expand': dMode === 'vertical' ? dExpand : isVisible,
150+
'is-expand': dMode === 'vertical' ? dExpand && dIncludeActive : isVisible,
149151
'is-disabled': dDisabled,
150152
})}
151153
style={{ paddingLeft: dSpace + dLevel * dStep }}

0 commit comments

Comments
 (0)