Skip to content

[Dialog] Allow listening for closed event #7793

@sissbruecker

Description

@sissbruecker

Describe your motivation

After refactoring the component to keep it's overlay within the shadow root, removing the component from the DOM will not trigger its closing animation anymore. To show the closing animation, developers would need to set opened to false and then wait until the closed event is fired before removing the component.

However, there currently is no way to listen for the closed event.

Describe the solution you'd like

For Dialog and ConfirmDialog, provide an addClosedListener method that allows registering a listener for when the closing animation has finished.

Also update the JavaDoc on addOpenedChangedListener to indicate that the event is fired when the "desired" opened state changes but before the closing animation has finished. Also mention addClosedListener should be used instead to wait for the closing animation to finish, for example to remove a dialog from the UI after it has closed.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions