Open abdulkareemnalband opened 5 years ago
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 .cdk-global-overlay-wrapper
element to have a z-index that's higher than the default of 1000. You cannot apply a style directly to this, but you can apply a class to the child element (panelClass).
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 likefull-window
dialogs, customdrop-downs
, and such things opening new overlay is hiding the notifications which we do not want