From 6c4c8cac611bf6b24220ac5a4914cb449325aef0 Mon Sep 17 00:00:00 2001 From: Cory Rylan Date: Wed, 2 Feb 2022 13:30:23 -0600 Subject: [PATCH] fix(core:modal): scroll check lifecycle - fix edge case of scroll check happening before first render Signed-off-by: Cory Rylan --- packages/core/src/modal/modal.element.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/modal/modal.element.ts b/packages/core/src/modal/modal.element.ts index 2a1825b29..253b7a3ee 100644 --- a/packages/core/src/modal/modal.element.ts +++ b/packages/core/src/modal/modal.element.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved. + * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved. * This software is released under MIT license. * The full license information can be found in LICENSE in the root directory of this project. */ @@ -150,8 +150,9 @@ export class CdsModal extends CdsInternalOverlay { this.observers.forEach(o => o.disconnect()); } - private setScrollableProperties() { + private async setScrollableProperties() { if (this.hidden === false) { + await this.updateComplete; // wait until after render to measure if scrollable this.isScrollable = isScrollable(this.content); this.content.tabIndex = this.isScrollable ? 0 : -1; this.content.ariaLabel = this.isScrollable ? this.i18n.contentBox : null;