Skip to content

Bug report: Accordion opening animation breaks when inside of an offcanvas #4849

@Mochitto

Description

@Mochitto

Description

When using an ngbAccordion inside of an offcanvas (not sure if also in other dynamic components such as modals etc.), the accordion can't calculate the correct height when expanding.

In my personal project it defaults to height: 0px (even with a <h1>hello world<h1>, so without conditional rendering or other manipulations of the DOM).
In the linked MRE, it calculates a very small height (ex. 30px) compared to the correct one (ex. 400px), resulting in either missing or choppy opening animation.

You can see the issue by inspecting the collapsing body; the inline style applied (height: <num>px) will be different between the demo on the docs and the same code inside of the offcanvas.

Not sure if it can help to figure the bug out, but Ngx-bootstrap's accordion seems to work correctly.

Bug reproduction:

https://stackblitz.com/edit/angular-226xjdu9?file=src%2Fapp%2Foffcanvas-basic.ts

How to reproduce:

Simply use the demo code for the offcanvas component and put the demo code from the accordion component inside of its body.

Workarounds

Using Ngx-bootstrap's accordion or other libraries' accordions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions