From dce495afd850e95e4eccae0a8f81c37f890342a7 Mon Sep 17 00:00:00 2001 From: Sven <38101365+svenvoskamp@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:14:41 +0100 Subject: [PATCH] fix: wui-list-accordion fix for wallet ui view (#1949) --- .../src/composites/wui-list-accordion/index.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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 -------------------------------------------- //