Skip to content

Commit

Permalink
fix(Menu): allow maxMenuHeight with Scrollabe (#6608)
Browse files Browse the repository at this point in the history
* fix(Menu): allow maxMenuHeight with Scrollabe

* stop setting heights to 'auto'
  • Loading branch information
nicolethoen authored Nov 15, 2021
1 parent 77f7603 commit 8c1f12c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions packages/react-core/src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@ class MenuBase extends React.Component<MenuProps, MenuState> {
onGetMenuHeight,
flyoutRef: this.state.flyoutRef,
setFlyoutRef: flyoutRef => this.setState({ flyoutRef }),
disableHover: this.state.disableHover,
isScrollable
disableHover: this.state.disableHover
}}
>
{isRootMenu && (
Expand Down
6 changes: 3 additions & 3 deletions packages/react-core/src/components/Menu/MenuContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export const MenuContent = React.forwardRef((props: MenuContentProps, ref: React
};
return (
<MenuContext.Consumer>
{({ menuId, onGetMenuHeight, isScrollable }) => (
{({ menuId, onGetMenuHeight }) => (
<div
{...rest}
className={css(styles.menuContent, props.className)}
ref={el => 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
}
>
Expand Down
4 changes: 1 addition & 3 deletions packages/react-core/src/components/Menu/MenuContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const MenuContext = React.createContext<{
flyoutRef?: React.Ref<HTMLLIElement>;
setFlyoutRef?: (ref: React.Ref<HTMLLIElement>) => void;
disableHover?: boolean;
isScrollable?: boolean;
}>({
menuId: null,
parentMenu: null,
Expand All @@ -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<{
Expand Down

0 comments on commit 8c1f12c

Please sign in to comment.