modal: cross browser modal breakout

This commit is contained in:
bordun 2020-04-28 10:46:22 +02:00
parent c155d18686
commit 4f0dd29714
3 changed files with 18 additions and 2 deletions

View file

@ -180,12 +180,18 @@ class Modal extends Panel {
// stacking
parent.container.style.zIndex = this.value ? 'initial' : ''
parent.container.style.contain = this.value ? 'size' : ''
parent.modalBreakout += (this.value ? 1 : -1)
if (parent.modalBreakout > 0) parent.container.classList.add('modal-breakout')
else if (parent.modalBreakout === 0) parent.container.classList.remove('modal-breakout')
parent = parent.parent
}
this.container.style.contain = this.value ? 'size' : ''
this.modalBreakout += (this.value ? 1 : -1)
if (this.modalBreakout > 0) this.container.classList.add('modal-breakout')
else if (this.modalBreakout === 0) this.container.classList.remove('modal-breakout')
}

View file

@ -62,6 +62,8 @@ class Panel extends Container() {
this.container.classList.toggle('no-scroll', !this.getProp('scroll'))
this.container.classList.add('layout-' + this.getProp('layout'))
this.modalBreakout = 0
var layout = this.getProp('layout')
if (layout === 'grid') {

View file

@ -484,6 +484,14 @@
}
.modal-breakout {
contain: size!important;
@supports not (contain: strict) {
transform: none!important; // cancel new stacking context
}
}
.matrix-container {