diff --git a/packages/components/src/components/post-collapsible/post-collapsible.tsx b/packages/components/src/components/post-collapsible/post-collapsible.tsx index 0749b45406..0cb665621f 100644 --- a/packages/components/src/components/post-collapsible/post-collapsible.tsx +++ b/packages/components/src/components/post-collapsible/post-collapsible.tsx @@ -66,14 +66,15 @@ export class PostCollapsible { @Method() async toggle(open = !this.isOpen): Promise { if (open === this.isOpen) return open; + this.isOpen = open; this.collapsed = !open; if (this.isLoaded) this.postToggle.emit(open); - + const animation = open ? expand(this.host) : collapse(this.host); - + if (!this.isLoaded || isMotionReduced()) animation.finish(); - + await animation.finished; const isHostRendered = this.host.offsetParent; @@ -81,7 +82,7 @@ export class PostCollapsible { if (open) { this.host.style.overflow = 'visible'; } - + return open; }