Inert attribute for content outside of modal

This commit is contained in:
Ulysse ARNAUD 2022-10-10 09:42:16 +02:00
parent a78e4d1327
commit 2bd4d44190

View file

@ -251,6 +251,11 @@ var ModalView = Backbone.View.extend({
}, },
show: function() { show: function() {
Array.from(document.body.children).forEach(function(child) {
if (child.className === 'modalView') return;
child.setAttribute('inert', '');
});
this.toggleZ(true); this.toggleZ(true);
// on reflow, change our class to animate. for whatever // on reflow, change our class to animate. for whatever
// reason if this is done immediately, chrome might combine // reason if this is done immediately, chrome might combine
@ -268,6 +273,12 @@ var ModalView = Backbone.View.extend({
this.toggleZ(false); this.toggleZ(false);
} }
}.bind(this), this.getAnimationTime()); }.bind(this), this.getAnimationTime());
Array.from(document.body.children).forEach(function(child) {
if (child.className === 'modalView') return;
child.removeAttribute('inert');
});
}, },
getInsideElement: function() { getInsideElement: function() {