-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Add support for hiding a dialog without closing it #6206
Comments
We intentionally support opening multiple dialogs at the same time. What is missing, however, is a way to hide a dialog without closing it when you only have a DialogRef. Going to re-purpose this issue for that feature. |
We could potentially do this by adding a |
How about a way to set an "inactive" class on the overlay pane that's automatically applied to all but the topmost dialog? |
If the default behavior is to hide the dialog, maybe the dialog.open({
hideOnCascade: false
}); The default behavior would be |
I would be interested to help out with this small feature. But |
#6289 will probably help. It makes Also agree with the dynamic add/remove classes approach since it gives you more flexibility of "inactive" dialogs that just hiding (e.g. lower opacity, transformations). |
The PR @willshowell's mentioned is a step in the right direction. Additionally, it'd be good to either have a way to add a class to a |
* feat(dialog): support adding/removing panelClasses to open dialogRef Fixes #6206 * address comments
…lar#14772) * feat(dialog): support adding/removing panelClasses to open dialogRef Fixes angular#6206 * address comments
…lar#14772) * feat(dialog): support adding/removing panelClasses to open dialogRef Fixes angular#6206 * address comments
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Only show one dialog at a time.
What is the expected behavior?
When a dialog is opened from within another dialog, all other open dialogs should be hidden.
What is the current behavior?
The new dialog gets layered on top of the old dialog(s)
What are the steps to reproduce?
Plunker: https://plnkr.co/edit/GglOLDnx1uJlZRgD4y1W?p=preview
What is the use-case or motivation for changing an existing behavior?
In angularjs material, multiple dialogs weren't allowed by default. See, for example http://plnkr.co/edit/qNu3q5XsIie1fYjKeJRc?p=preview. Ideally, though, there'd be a virtual stack of dialogs maintained, where only the topmost item on the stack is visible.
Is there anything else we should know?
Currently, I can work around the issue by running
Array.from(document.querySelectorAll(".cdk-overlay-container .cdk-global-overlay-wrapper")) .forEach((node, index, array) => (index !== array.length - 1) ? (<HTMLElement> node).style.display = "none" : true);
in ngOnInit, and running
Array.from(document.querySelectorAll(".cdk-overlay-container .cdk-global-overlay-wrapper")) .forEach((node) =>(<HTMLElement> node).style.display = "" );
in ngOnDestroy.
This works, and effectively creates a stack of hidden dialogs. But I don't want to add that snippet in every dialog that could possibly be opened from another dialog.
The text was updated successfully, but these errors were encountered: