angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.36k stars 6.74k forks source link

bug(dialog): afterOpened not always emitted #26295

Open romainmoreau opened 1 year ago

romainmoreau commented 1 year ago

Is this a regression?

The previous version in which this bug was not present was

14

Description

afterOpened is not emitted when the dialog is closed too fast.

Reproduction

I noticed this issue running some e2e tests but it also can be manually reproduced: basically just go to https://stackblitz.com/edit/afteropened-not-always-emitted-15 and double click on the button.

Expected Behavior

afterOpened should always emit a value before closing the dialog like in v14.

https://stackblitz.com/edit/afteropened-not-always-emitted-14

Actual Behavior

afterOpened is not emitted when the dialog is closed too fast.

https://stackblitz.com/edit/afteropened-not-always-emitted-15

Environment

crisbeto commented 1 year ago

Currently this is working as expected. afterOpened emits after the opening sequence has finished which doesn't happen if you close it too quickly.

romainmoreau commented 1 year ago

It should be possible to simulate the previous behavior by combining beforeClosed and afterOpened but I think the behavior in v14 made more sense because it was simplier and more intuitive:

Diagramme sans nom drawio(2)

Maybe at least it should be mentionned somewhere because it silently breaks code migrated to v15 expecting afterOpened to be always emitted.