From 855bb86fee1cbe64cb4b9783a270e3e19a8f29e5 Mon Sep 17 00:00:00 2001 From: Maxim Balaganskiy Date: Thu, 5 May 2022 13:22:10 +1000 Subject: [PATCH] fix(expandable): change height asynchronously Fixes an issue with initially open expandable --- packages/expandable/src/mdc-expandable.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/expandable/src/mdc-expandable.ts b/packages/expandable/src/mdc-expandable.ts index dd6175a8..51248a30 100644 --- a/packages/expandable/src/mdc-expandable.ts +++ b/packages/expandable/src/mdc-expandable.ts @@ -57,7 +57,9 @@ export class MdcExpandable { if (this.open) { // after transition set body height to auto so that expandable children are visible this.contentContainer.addEventListener('transitionend', this); - this.contentContainer.style.height = `${this.content.clientHeight}px`; + this.taskQueue.queueTask(() => { + this.contentContainer.style.height = `${this.content.clientHeight}px`; + }); } else { // the following line is needed because height has been restored to auto' this.contentContainer.style.height = `${this.content.clientHeight}px`;