From b14a39c4ded92bd15405f8cdf5c356542c436b8d Mon Sep 17 00:00:00 2001 From: Raphael Mattos Date: Mon, 23 Oct 2023 13:54:44 -0300 Subject: [PATCH] fix(cxl-ui): fix wrong nav overlays-wrapper height --- packages/cxl-ui/src/components/cxl-marketing-nav.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/cxl-ui/src/components/cxl-marketing-nav.js b/packages/cxl-ui/src/components/cxl-marketing-nav.js index bac65a3f5..314eea50b 100644 --- a/packages/cxl-ui/src/components/cxl-marketing-nav.js +++ b/packages/cxl-ui/src/components/cxl-marketing-nav.js @@ -297,10 +297,13 @@ export class CXLMarketingNavElement extends LitElement { const firstOverlay = overlays[0]; if (this.overlaysWrapperElement) { - this.overlaysWrapperElement.style.maxHeight = `${ - window.innerHeight - - (this.overlaysWrapperElement.style?.maxHeight || firstOverlay.offsetTop) - }px`; + if (overlays.length > 1) { + const heightOffset = + this.overlaysWrapperElement.style?.maxHeight || firstOverlay.offsetTop; + this.overlaysWrapperElement.style.maxHeight = `${ + window.innerHeight - (heightOffset || 0) + }px`; + } this.overlaysWrapperElement.appendChild(overlay); this.overlaysWrapperElement.toggleAttribute('hidden', false);