Skip to content

Commit

Permalink
fix(ui:menu): fix popup in vertical mode
Browse files Browse the repository at this point in the history
  • Loading branch information
xiejay97 committed Mar 15, 2022
1 parent c9f6702 commit 686ef7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/ui/src/components/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export function DMenu<ID extends DId, T extends DMenuOption<ID>>(props: DMenuPro
const index = sameLevelOptions.findIndex((o) => o.id === optionId);
const o = nth(sameLevelOptions, index - 1);
focusOption(o);
if (o && nth(popupIds, -1)?.id === optionId) {
if (dMode !== 'vertical' && o && nth(popupIds, -1)?.id === optionId) {
setPopupIds(popupIds.slice(0, -1));
}
break;
Expand All @@ -284,7 +284,7 @@ export function DMenu<ID extends DId, T extends DMenuOption<ID>>(props: DMenuPro
const index = sameLevelOptions.findIndex((o) => o.id === optionId);
const o = nth(sameLevelOptions, (index + 1) % sameLevelOptions.length);
focusOption(o);
if (o && nth(popupIds, -1)?.id === optionId) {
if (dMode !== 'vertical' && o && nth(popupIds, -1)?.id === optionId) {
setPopupIds(popupIds.slice(0, -1));
}
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/menu/MenuSub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export function DMenuSub(props: DMenuSubProps): JSX.Element | null {

return (
<DPopup
disabled={disabled}
disabled={disabled || dMode === 'vertical'}
dVisible={dPopupState}
dPopup={({ pOnClick, pOnMouseEnter, pOnMouseLeave, ...restPCProps }) => (
<ul
Expand Down

0 comments on commit 686ef7e

Please sign in to comment.