diff --git a/src/lib/Accordion/Accordion.svelte b/src/lib/Accordion/Accordion.svelte index 8bdd1c5..c3dd346 100644 --- a/src/lib/Accordion/Accordion.svelte +++ b/src/lib/Accordion/Accordion.svelte @@ -6,10 +6,14 @@ let accordionRef: HTMLElement; function updateMaxHeight() { - if (expand) { - accordionRef.style.maxHeight = `${maxHeight}px`; - } else { - accordionRef.style.maxHeight = '0'; + try { + if (expand) { + accordionRef.style.maxHeight = `${maxHeight}px`; + } else { + accordionRef.style.maxHeight = '0'; + } + } catch (e) { + console.error('Error while updating style of accordian', e); } }