Skip to content

feature(CdkAccordion): closeAll works without multi=true #22003

Closed
ToWipf/jasmarty
#155
@kvetis

Description

@kvetis

Feature Description

Currently, CdkAccordion.closeAll only works on when multi=true. While this makes sense as a counterpart to openAll, it would also make sense to allow the method to work also when only one item is opened.

Use Case

Programatically closing any open accordion item when not sure which is open - eg. when adding a new item. Opening the item on addition (onInit) causes "Expression changed after it was checked" type of bug when other is open - it does not close, because it was already checked.

Avoiding this mess:

   this.dCollapseGroup.multi = true;
   this.dCollapseGroup.closeAll();
   this.dCollapseGroup.multi = false;

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/accordion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions