-
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
Make an overlay always on top of other overlays #14650
Comments
For now, I am using the following workaround: // somewhere_in_my_code.ts
const tmpClass = `panel-${Date.now()}`;
const dialog = this.dialog.open(ConfirmComponent,
{data: {message}, panelClass: tmpClass, backdropClass: ['cdk-overlay-dark-backdrop', 'overlay-priority-1']});
dialog.afterOpened().subscribe(() => {
if (typeof document !== 'undefined') {
const panel = document.querySelector(`.${tmpClass}`);
if (panel && panel.parentElement) {
panel.parentElement.classList.add('overlay-priority-1');
}
}
}); // styles.scss
.overlay-priority-1 {
z-index: 1001 !important;
} |
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends. Find more details about Angular's feature request process in our documentation. |
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage. We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package. You can find more details about the feature request process in our documentation. |
Just my 2 cents for others looking for an answer. To achieve what you want, set the With modern css you can also use the :has selector to style an element based on child elements. This way you don't have to use the javscript alternative in the previous comment. (caniuse support for :has is at 91% and supported in all major browsers) const overlayConfig = new OverlayConfig({
// .. other settings
panelClass: 'overlay-priority',
}); And in your global (s)css .cdk-global-overlay-wrapper:has(.cdk-overlay-pane.overlay-priority) {
z-index: 1001; // default modals are 1000
} |
Please describe the feature you would like to request.
whenever a new overlay is created it is positions on top of other existing overlays (speaking wrt z-index).
provide a way to mark a overlay need to be shown always on top of other overlay's irrespective of order of creation
What is the use-case or motivation for this proposal?
In our application we are using
overlay
as container for in-app notifications (we don't use/follow material spec)We also use overlay for different use-cases like
full-window
dialogs, customdrop-downs
, and such thingsopening new overlay is hiding the notifications which we do not want
The text was updated successfully, but these errors were encountered: