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

bug(cdk/dialog): Closed observable not emitting when closed by navigation #26581

Closed
1 task
mpo-dev opened this issue Feb 7, 2023 · 2 comments · Fixed by #26608
Closed
1 task

bug(cdk/dialog): Closed observable not emitting when closed by navigation #26581

mpo-dev opened this issue Feb 7, 2023 · 2 comments · Fixed by #26608
Assignees
Labels
area: cdk/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@mpo-dev
Copy link

mpo-dev commented Feb 7, 2023

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

The closed observable is not emitting when the CDK dialog is being closed by navigation when the closeOnNavigation: true property is applied. As a side effect of the dialog not properly closing, the dialog ref is also kept in the Dialog.openDialogs list.

Reproduction

Steps to reproduce:

  1. Open a CDK dialog with closeOnNavigation: true
  2. Navigate away

Expected Behavior

The dialog to close properly

Actual Behavior

The closed observable is not emtting and the dialog is being kept in de list with open dialogs

Environment

  • Angular: 15.1.0
  • CDK/Material: 15.1.0
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 11
@mpo-dev mpo-dev added the needs triage This issue needs to be triaged by the team label Feb 7, 2023
@mpo-dev
Copy link
Author

mpo-dev commented Feb 7, 2023

Upon further inspection, it seems the material dialog is behaving properly due to this subscription on the overlay detachments:

_ref.overlayRef.detachments().subscribe(() => {
this._beforeClosed.next(this._result);
this._beforeClosed.complete();
this._finishDialogClose();
});

@crisbeto crisbeto self-assigned this Feb 12, 2023
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: cdk/dialog and removed needs triage This issue needs to be triaged by the team labels Feb 12, 2023
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 12, 2023
Fixes that the CDK dialog wasn't emitting to the `closed` event when it is detached externally, e.g. by a scroll strategy or a navigation. We had unit tests for this on the Material side, but we had special logic to handle it there.

Fixes angular#26581.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 21, 2023
Fixes that the CDK dialog wasn't emitting to the `closed` event when it is detached externally, e.g. by a scroll strategy or a navigation. We had unit tests for this on the Material side, but we had special logic to handle it there.

Fixes angular#26581.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 21, 2023
Fixes that the CDK dialog wasn't emitting to the `closed` event when it is detached externally, e.g. by a scroll strategy or a navigation. We had unit tests for this on the Material side, but we had special logic to handle it there.

Fixes angular#26581.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 21, 2023
Fixes that the CDK dialog wasn't emitting to the `closed` event when it is detached externally, e.g. by a scroll strategy or a navigation. We had unit tests for this on the Material side, but we had special logic to handle it there.

Fixes angular#26581.
crisbeto added a commit that referenced this issue Feb 21, 2023
…26608)

Fixes that the CDK dialog wasn't emitting to the `closed` event when it is detached externally, e.g. by a scroll strategy or a navigation. We had unit tests for this on the Material side, but we had special logic to handle it there.

Fixes #26581.
crisbeto added a commit that referenced this issue Feb 21, 2023
…26608)

Fixes that the CDK dialog wasn't emitting to the `closed` event when it is detached externally, e.g. by a scroll strategy or a navigation. We had unit tests for this on the Material side, but we had special logic to handle it there.

Fixes #26581.

(cherry picked from commit 8f29413)
crisbeto added a commit that referenced this issue Feb 21, 2023
…26608)

Fixes that the CDK dialog wasn't emitting to the `closed` event when it is detached externally, e.g. by a scroll strategy or a navigation. We had unit tests for this on the Material side, but we had special logic to handle it there.

Fixes #26581.

(cherry picked from commit 8f29413)
@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 Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: cdk/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants