Components: mat-expansion-panel opens all panels in the mat-accordian when used with in mat-menu

Created on 20 Feb 2018  路  5Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug: mat-expansion-panel opens all panels in the mat-accordian when used with in mat-menu

What is the expected behavior?

All panels should close by default.

What is the current behavior?

All panels is open by default.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-xw9sqj

Similiar Issue
https://stackoverflow.com/q/48388343/1267073

What is the use-case or motivation for changing an existing behavior?

Use-case- Show a folder structure view

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular - 5.2.5
material - 5.2.1

#### Is there anything else we should know?
-

Most helpful comment

Any suggestions to implement that use case ?

All 5 comments

Closing as placing a MatAccordion or MatExpansionPanel inside of a mat-menu element is not a supported configuration.

Any suggestions to implement that use case ?

@sajaynambiar I would like to see this supported or a way to implement this as well.

You can get around this by manually updating the classes-- I think you could fix the animations using a css animation (but haven't worked that part out 100% yet) .

Would be something like this in the .ng.html:
<mat-expansion-panel #myPanel [class.is-expanded]="myPanel.expanded" [class.is-collapsed]="!myPanel.expanded">

and in the css:

.is-expanded { 
  .mat-expansion-panel-content { 
      visibility: inherit !important; //overwrite the element style
      height: inherit !important; //overwrite the element style
  }
}

.is--collapsed {
 .mat-expansion-panel-content {
       overflow: hidden;
      height: 0;
      visibility: hidden;
 }
}

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings