in components/RuiExpandCollapse/src/RuiExpandCollapse.ts [134:152]
private _triggerCollapseAnimation(): void {
// add back height style and then remove on next frame to trigger animation
requestAnimationFrame((): void => {
if (this._collapsibleEl) {
// remove expand transition listener if it has not already ticked over
this._collapsibleEl.removeEventListener('transitionend', this._expandTransitionEndHandler);
const sectionHeight = this._collapsibleEl.scrollHeight;
this._collapsibleEl.style.height = `${sectionHeight}px`;
this._collapsibleEl.classList.add('hide-content');
requestAnimationFrame((): void => {
if (this._collapsibleEl) {
this._collapsibleEl.style.height = '0px';
this._collapsibleEl.addEventListener('transitionend', this._collapseTransitionEndHandler);
}
})
}
})
}