Skip to content
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

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

Closed
kvetis opened this issue Feb 24, 2021 · 1 comment · Fixed by #22055 or ToWipf/jasmarty#155
Closed

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

kvetis opened this issue Feb 24, 2021 · 1 comment · Fixed by #22055 or ToWipf/jasmarty#155
Assignees
Labels
area: cdk/accordion P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@kvetis
Copy link

kvetis commented Feb 24, 2021

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;
@kvetis kvetis added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Feb 24, 2021
@crisbeto crisbeto self-assigned this Feb 28, 2021
@crisbeto crisbeto added area: cdk/accordion P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Feb 28, 2021
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 28, 2021
…is disabled

Currently `CdkAccordion.closeAll` only works if `multi` is set to false, however it makes
sense when a single item is expanded as well.

These changes also fix that `_openCloseAllActions` wasn't being completed and they
include more unit tests.

Fixes angular#22003.
wagnermaciel pushed a commit that referenced this issue Mar 2, 2021
…is disabled (#22055)

Currently `CdkAccordion.closeAll` only works if `multi` is set to false, however it makes
sense when a single item is expanded as well.

These changes also fix that `_openCloseAllActions` wasn't being completed and they
include more unit tests.

Fixes #22003.
wagnermaciel pushed a commit that referenced this issue Mar 2, 2021
…is disabled (#22055)

Currently `CdkAccordion.closeAll` only works if `multi` is set to false, however it makes
sense when a single item is expanded as well.

These changes also fix that `_openCloseAllActions` wasn't being completed and they
include more unit tests.

Fixes #22003.

(cherry picked from commit a41fb6e)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.