I had the same problem, I had need a validation and as result the outside click (on backdrop) shouldn't effect.
Remove the backdrop events with pointer-events allows interactions in all behind element, my solution was create a clone of backdrop and remove the listeners of this clone.
avoidClickOutside() {
const overlayers = this.overlay
.getContainerElement()
.querySelectorAll('.controlled');
if (overlayers && this.isAvoidClickOutside) {
overlayers.forEach((element) => {
const clone = element.cloneNode(true);
(clone as Element).classList.add('clone');
clone.addEventListener('click', (event: Event) => {
if (confirm('Not allowed... Do you want remove this behaviour?!')) {
this.removeCloneBackdrop();
}
});
element.parentNode.insertBefore(clone, element.nextSibling);
});
}
}
isAvoidClickOutside is my control variable to either avoid or not.
Available: https://stackblitz.com/edit/angular-yjvkft