Skip to content

Commit

Permalink
fix(expandable): change height asynchronously
Browse files Browse the repository at this point in the history
Fixes an issue with initially open expandable
  • Loading branch information
MaximBalaganskiy committed Sep 1, 2023
1 parent 9344a22 commit 855bb86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/expandable/src/mdc-expandable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down

0 comments on commit 855bb86

Please sign in to comment.