From 2bd4d4419046d2acb74ef1f311c7211776096535 Mon Sep 17 00:00:00 2001 From: Ulysse ARNAUD Date: Mon, 10 Oct 2022 09:42:16 +0200 Subject: [PATCH 1/2] Inert attribute for content outside of modal --- src/js/views/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/js/views/index.js b/src/js/views/index.js index eef086fb..011988b1 100644 --- a/src/js/views/index.js +++ b/src/js/views/index.js @@ -251,6 +251,11 @@ var ModalView = Backbone.View.extend({ }, show: function() { + Array.from(document.body.children).forEach(function(child) { + if (child.className === 'modalView') return; + child.setAttribute('inert', ''); + }); + this.toggleZ(true); // on reflow, change our class to animate. for whatever // reason if this is done immediately, chrome might combine @@ -268,6 +273,12 @@ var ModalView = Backbone.View.extend({ this.toggleZ(false); } }.bind(this), this.getAnimationTime()); + + + Array.from(document.body.children).forEach(function(child) { + if (child.className === 'modalView') return; + child.removeAttribute('inert'); + }); }, getInsideElement: function() { From 7d559281c9e544314e493c30a595e328432afde5 Mon Sep 17 00:00:00 2001 From: Ulysse ARNAUD Date: Mon, 10 Oct 2022 09:51:46 +0200 Subject: [PATCH 2/2] Changed className to classList --- src/js/views/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/views/index.js b/src/js/views/index.js index 011988b1..bf52fcc4 100644 --- a/src/js/views/index.js +++ b/src/js/views/index.js @@ -252,7 +252,7 @@ var ModalView = Backbone.View.extend({ show: function() { Array.from(document.body.children).forEach(function(child) { - if (child.className === 'modalView') return; + if (child.classList.contains('modalView')) return; child.setAttribute('inert', ''); }); @@ -276,7 +276,7 @@ var ModalView = Backbone.View.extend({ Array.from(document.body.children).forEach(function(child) { - if (child.className === 'modalView') return; + if (child.classList.contains('modalView')) return; child.removeAttribute('inert'); }); },