diff --git a/packages/ui/src/composites/wui-list-accordion/index.ts b/packages/ui/src/composites/wui-list-accordion/index.ts index ea08cca9ea..1874c8f19f 100644 --- a/packages/ui/src/composites/wui-list-accordion/index.ts +++ b/packages/ui/src/composites/wui-list-accordion/index.ts @@ -15,19 +15,22 @@ export class WuiListAccordion extends LitElement { // -- State & Properties -------------------------------- // @property() public textTitle = '' - @property() public overflowedContent = '' public toggled = false - public enableAccordion = false - public scrollElement?: Element = undefined - public scrollHeightElement = 0 - public override firstUpdated() { - setTimeout(() => { + public override updated(changedProperties: Map) { + super.updated(changedProperties) + if (changedProperties.has('textTitle') || changedProperties.has('overflowedContent')) { + this.checkHeight() + } + } + + private checkHeight() { + this.updateComplete.then(() => { const heightElement = this.shadowRoot?.querySelector('.heightContent') const textElement = this.shadowRoot?.querySelector('.textContent') @@ -41,7 +44,7 @@ export class WuiListAccordion extends LitElement { this.requestUpdate() } } - }, 0) + }) } // -- Render -------------------------------------------- //