diff --git a/packages/fineui/src/core/utils/dom.js b/packages/fineui/src/core/utils/dom.js index fbee6b287..1be70de14 100644 --- a/packages/fineui/src/core/utils/dom.js +++ b/packages/fineui/src/core/utils/dom.js @@ -744,10 +744,11 @@ export function getComboPosition(combo, popup, extraWidth, extraHeight, needAdap if (needAdaptHeight === true && popup.resetHeight) { const comboRect = combo.element[0].getBoundingClientRect(); const relativeOffset = positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0; - if (position.top < comboRect.top) { - popup.resetHeight(Math.min(viewportBounds.height - position.top - relativeOffset, comboRect.top, maxHeight)); - } else if (position.top >= comboRect.bottom) { - popup.resetHeight(Math.min(viewportBounds.height - position.top - relativeOffset, viewportBounds.height - comboRect.bottom, maxHeight)); + const positionTop = position.top + relativeOffset; + if (positionTop < comboRect.top) { + popup.resetHeight(Math.min(viewportBounds.height - positionTop, comboRect.top, maxHeight)); + } else if (positionTop >= comboRect.bottom) { + popup.resetHeight(Math.min(viewportBounds.height - positionTop, viewportBounds.height - comboRect.bottom, maxHeight)); } }