\n this.refAccordionDiv = el}\n class=\"show-more__accordion\"\n onTransitionEnd={_e => this.onAccordionDivTransitionEnd()}\n >\n\n \n\n {this.fadeBottom ?\n : null\n }\n\n
\n\n \n
\n \n )\n\n }\n\n onAccordionButtonClick(event) {\n event.preventDefault();\n this.expanded = !this.expanded;\n }\n\n onAccessibilityButtonClick(event) {\n event.preventDefault();\n if (this.expanded) {\n let firstFocusableElement = this.getFirstFocusableHideableElement();\n if (firstFocusableElement)\n firstFocusableElement.focus();\n }\n }\n\n onAccordionDivTransitionEnd() {\n if (this.expanded) {\n this.refAccordionDiv.style.maxHeight = \"none\";\n }\n if (!this.expanded) {\n this.getHideableElements().forEach((el: HTMLElement) => el.setAttribute(\"hidden\", \"true\"));\n if (this.refAccordionButton.getBoundingClientRect().top < 0)\n this.refAccordionButton.scrollIntoView();\n }\n }\n\n isMultipleOfElements(height) {\n return height.toString().includes(\" \");\n }\n\n setAccordionHeight(height) {\n if (this.refAccordionDiv.style.maxHeight == \"none\")\n this.refAccordionDiv.style.maxHeight = this.refAccordionDiv.scrollHeight + \"px\";\n\n setTimeout(() => {\n if (typeof height === \"number\") {\n this.refAccordionDiv.style.maxHeight = height + \"px\";\n } else if (this.isMultipleOfElements(height)) {\n const accordionTop = this.refAccordionDiv.getBoundingClientRect().top;\n const accordionBottom = Math.max(...this.getVisibleElements().map(el => el.getBoundingClientRect().bottom));\n this.refAccordionDiv.style.maxHeight = accordionBottom - accordionTop + \"px\";\n } else {\n this.refAccordionDiv.style.maxHeight = height;\n }\n }, 1)\n }\n\n getVisibleElements(): Array