diff --git a/packages/core/src/Popover.js b/packages/core/src/Popover.js index 0297b01c..d2962535 100644 --- a/packages/core/src/Popover.js +++ b/packages/core/src/Popover.js @@ -15,6 +15,7 @@ import closable from './mixins/closable'; import renderToLayer from './mixins/renderToLayer'; import './styles/Popover.scss'; +import { verticalPlacements } from './mixins/anchored/getPositionState'; export const COMPONENT_NAME = prefixClass('popover'); const ROOT_BEM = icBEM(COMPONENT_NAME); @@ -48,7 +49,11 @@ function Popover({ * The `maxHeight` is for `BEM.container`, which doesn't include root class padding. * So we need to minus POPOVER_PADDING here. */ - const maxHeight = remainingSpace ? remainingSpace - POPOVER_PADDING : undefined; + const maxHeight = ( + (remainingSpace && verticalPlacements.includes(placement)) + ? remainingSpace - POPOVER_PADDING + : undefined + ); const handleWrapperClick = (event) => { onInsideClick(event); diff --git a/packages/core/src/mixins/anchored/getPositionState.js b/packages/core/src/mixins/anchored/getPositionState.js index 9862c722..87136fb7 100644 --- a/packages/core/src/mixins/anchored/getPositionState.js +++ b/packages/core/src/mixins/anchored/getPositionState.js @@ -5,8 +5,8 @@ import PLACEMENT from './constants/placement'; export { PLACEMENT }; const { TOP, BOTTOM, LEFT, RIGHT } = PLACEMENT; -const verticalPlacements = [TOP, BOTTOM]; -const horizontalPlacements = [LEFT, RIGHT]; +export const verticalPlacements = [TOP, BOTTOM]; +export const horizontalPlacements = [LEFT, RIGHT]; /** * @typedef {typeof TOP| typeof BOTTOM} Placement