From 8c1f12c2b0e86bbc5ba1071db3ebf29fee7421a0 Mon Sep 17 00:00:00 2001 From: Nicole Thoen Date: Mon, 15 Nov 2021 15:50:16 -0500 Subject: [PATCH] fix(Menu): allow maxMenuHeight with Scrollabe (#6608) * fix(Menu): allow maxMenuHeight with Scrollabe * stop setting heights to 'auto' --- packages/react-core/src/components/Menu/Menu.tsx | 3 +-- packages/react-core/src/components/Menu/MenuContent.tsx | 6 +++--- packages/react-core/src/components/Menu/MenuContext.ts | 4 +--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/react-core/src/components/Menu/Menu.tsx b/packages/react-core/src/components/Menu/Menu.tsx index 627198f9129..b9e6bac329b 100644 --- a/packages/react-core/src/components/Menu/Menu.tsx +++ b/packages/react-core/src/components/Menu/Menu.tsx @@ -262,8 +262,7 @@ class MenuBase extends React.Component { onGetMenuHeight, flyoutRef: this.state.flyoutRef, setFlyoutRef: flyoutRef => this.setState({ flyoutRef }), - disableHover: this.state.disableHover, - isScrollable + disableHover: this.state.disableHover }} > {isRootMenu && ( diff --git a/packages/react-core/src/components/Menu/MenuContent.tsx b/packages/react-core/src/components/Menu/MenuContent.tsx index 2fe6471bd00..840fac5d34c 100644 --- a/packages/react-core/src/components/Menu/MenuContent.tsx +++ b/packages/react-core/src/components/Menu/MenuContent.tsx @@ -28,15 +28,15 @@ export const MenuContent = React.forwardRef((props: MenuContentProps, ref: React }; return ( - {({ menuId, onGetMenuHeight, isScrollable }) => ( + {({ menuId, onGetMenuHeight }) => (
refCallback(el, menuId, onGetMenuHeight)} style={ { - '--pf-c-menu__content--Height': menuHeight || 'auto', - '--pf-c-menu__content--MaxHeight': !isScrollable ? maxMenuHeight || 'auto' : '' + ...(menuHeight && { '--pf-c-menu__content--Height': menuHeight }), + ...(maxMenuHeight && { '--pf-c-menu__content--MaxHeight': maxMenuHeight }) } as React.CSSProperties } > diff --git a/packages/react-core/src/components/Menu/MenuContext.ts b/packages/react-core/src/components/Menu/MenuContext.ts index 687b1fcb4e9..1774ab022b0 100644 --- a/packages/react-core/src/components/Menu/MenuContext.ts +++ b/packages/react-core/src/components/Menu/MenuContext.ts @@ -15,7 +15,6 @@ export const MenuContext = React.createContext<{ flyoutRef?: React.Ref; setFlyoutRef?: (ref: React.Ref) => void; disableHover?: boolean; - isScrollable?: boolean; }>({ menuId: null, parentMenu: null, @@ -30,8 +29,7 @@ export const MenuContext = React.createContext<{ onGetMenuHeight: () => null, flyoutRef: null, setFlyoutRef: () => null, - disableHover: false, - isScrollable: false + disableHover: false }); export const MenuItemContext = React.createContext<{