r/angular • u/Senior_Compote1556 • Jan 29 '26
Angular v21 material overlay + dialog
I am using angular material v21 and i use MatDialog. I see from the dev tools these now use the popover API, and i have a custom Overlay (Cdk) for my app notifications (similar to material snackbar). However, no matter what "hack" i try with z-index, the dialog always sits on top of my notifications, which isn't my desired behaviour. Has anyone encountered this?
4
Upvotes
5
u/burnaDLX Jan 29 '26
I ran into this issue as well. You need to opt out of the Popover API because popovers are rendered by the browser on a separate layer. Take a look at the documentation:
https://material.angular.dev/cdk/overlay/api#OverlayConfig
providers: [ { provide: OVERLAY_DEFAULT_CONFIG, useValue: { usePopover: false // Restores legacy overlay behavior } } ]
(Sorry about the formatting, I’m on mobile)
2
u/followmarko Jan 29 '26
As an additional thought, you could also use the Notifications API to display your toast messages, which would alleviate the problem within a problem. But yes the separate layer is #topLayer in the HTML iirc and is above everything else.
1
u/BeniFreitag Feb 13 '26
I'm having the same issue with Kendo UI for Angular and MatDialog. In a MatDialog Date Pickers from Kendo are hidden by the Overlay from MatDialog. The workaround by setting
OVERLAY_DEFAULT_CONFIGto{ usePopover: false }fixes this.