-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expansion panels in factoried content are open initially #16503
Comments
While it's still an issue I think needs to be fixed, I ran into this myself and have a workaround that may help other people out for now. If your situation allows, lazy loading (seen at bottom of docs page: https://material.angular.io/components/expansion/overview) and explicitly directing the panels to be closed with |
So the workaround worked for me when I surrounded the content of the expansion panel with: <ng-template matExpansionPanelContent>
Your content
</ng-template> You should end up with your panel looking something like this: <mat-expansion-panel>
<mat-expansion-panel-header>
This is the expansion title
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
Some deferred content
</ng-template>
</mat-expansion-panel> As suggested by @benjaminkimble and seen in the docs under as seen in https://material.angular.io/components/expansion/overview#lazy-rendering. A big improvement for me but it's not perfect because the padding-top or margin-top is changing now when it would show the content of the expansion panel before. |
Reworks the expansion panel to animate purely with CSS, rather than going through the `@angular/animations` module. This simplifies the setup and allows us to resolve several long-standing bug reports. Fixes angular#27946. Fixes angular#22715. Fixes angular#21434. Fixes angular#20610. Fixes angular#20517. Fixes angular#17177. Fixes angular#16534. Fixes angular#16503. Fixes angular#14952. Fixes angular#14759. Fixes angular#14075. Fixes angular#11765.
Reworks the expansion panel to animate purely with CSS, rather than going through the `@angular/animations` module. This simplifies the setup and allows us to resolve several long-standing bug reports. Fixes angular#27946. Fixes angular#22715. Fixes angular#21434. Fixes angular#20517. Fixes angular#17177. Fixes angular#16534. Fixes angular#16503. Fixes angular#14952. Fixes angular#14759. Fixes angular#14075. Fixes angular#11765.
Reworks the expansion panel to animate purely with CSS, rather than going through the `@angular/animations` module. This simplifies the setup and allows us to resolve several long-standing bug reports. Fixes #27946. Fixes #22715. Fixes #21434. Fixes #20517. Fixes #17177. Fixes #16534. Fixes #16503. Fixes #14952. Fixes #14759. Fixes #14075. Fixes #11765. (cherry picked from commit aafa151)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Factoried components containing expansion panels will show the expansion panels as open when the component is inside another (like sidenav) that enters the DOM. Non-factoried expansion panels do not have the same issue. Likely related to #11765
Reproduction
https://stackblitz.com/edit/sidenav-accordion-expansion
Steps to reproduce:
Expected Behavior
Sidenav should not be open during sidenav enter
Environment
The text was updated successfully, but these errors were encountered: