From 8b66e2c643d9736e3fab0da7814b33cad05c2bdb Mon Sep 17 00:00:00 2001 From: Jeffrey Sturek Date: Thu, 15 Nov 2018 14:25:38 -0600 Subject: [PATCH 1/2] Fix body scroll bug with desktop nav closing without clicking close and resizing bewteen mobile and desktop --- wdn/templates_5.0/js-src/navigation.babel.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/wdn/templates_5.0/js-src/navigation.babel.js b/wdn/templates_5.0/js-src/navigation.babel.js index e9a3dd4d4..5b08f5497 100644 --- a/wdn/templates_5.0/js-src/navigation.babel.js +++ b/wdn/templates_5.0/js-src/navigation.babel.js @@ -47,18 +47,15 @@ define(['plugins/headroom', 'plugins/body-scroll-lock', 'mustard/inert-polyfill' function openModal() { if (window.matchMedia("(max-width: 56.12em)").matches) { - body.classList.add('dcf-overflow-hidden'); main.setAttribute('inert', ''); footer.setAttribute('inert', ''); + disableBodyScroll(mobileNavMenu); } modalParent.classList.add('dcf-modal-open'); for (var i = 0; i < toggleButtons.length; ++i) { toggleButtons[i].setAttribute('aria-expanded', 'true'); } - // Prevent body scroll when navigation is open - disableBodyScroll(mobileNavMenu); - // Hide other mobile toggles document.dispatchEvent(closeSearchEvent); document.dispatchEvent(closeIDMOptionsEvent); @@ -69,7 +66,6 @@ define(['plugins/headroom', 'plugins/body-scroll-lock', 'mustard/inert-polyfill' function closeModal() { if (window.matchMedia("(max-width: 56.12em)").matches) { - body.classList.remove('dcf-overflow-hidden'); main.removeAttribute('inert'); footer.removeAttribute('inert'); } @@ -91,6 +87,19 @@ define(['plugins/headroom', 'plugins/body-scroll-lock', 'mustard/inert-polyfill' } }); + // add an event listener for resize + window.addEventListener('resize', function(e) { + if (window.matchMedia("(max-width: 56.12em)").matches && modalParent.classList.contains('dcf-modal-open')) { + main.setAttribute('inert', ''); + footer.setAttribute('inert', ''); + disableBodyScroll(mobileNavMenu); + } else { + main.removeAttribute('inert'); + footer.removeAttribute('inert'); + enableBodyScroll(mobileNavMenu); + } + }); + let toggleButtonOnClick = function() { activeToggleButton = this; if (modalParent.classList.contains('dcf-modal-open')) { From cb2006e89d1ba2594e3025067461b5056b57e6b8 Mon Sep 17 00:00:00 2001 From: Jeff Sturek Date: Fri, 16 Nov 2018 17:33:32 -0600 Subject: [PATCH 2/2] Add Editable JSbody to App templates (#1209) --- Templates/app.dwt | 3 +++ Templates/app_debug.dwt | 3 +++ Templates/app_local.dwt | 3 +++ Templates/jsp.app.dwt.jsp | 3 +++ Templates/jsp.app_debug.dwt.jsp | 3 +++ Templates/jsp.app_local.dwt.jsp | 3 +++ Templates/php.app.dwt.php | 3 +++ Templates/php.app_debug.dwt.php | 3 +++ Templates/php.app_local.dwt.php | 3 +++ 9 files changed, 27 insertions(+) diff --git a/Templates/app.dwt b/Templates/app.dwt index 19b06143f..c97c9bd2e 100644 --- a/Templates/app.dwt +++ b/Templates/app.dwt @@ -67,5 +67,8 @@ + + + diff --git a/Templates/app_debug.dwt b/Templates/app_debug.dwt index ae5e46a63..d2b42fe77 100644 --- a/Templates/app_debug.dwt +++ b/Templates/app_debug.dwt @@ -67,5 +67,8 @@ + + + diff --git a/Templates/app_local.dwt b/Templates/app_local.dwt index 04452a2d6..029f188ab 100644 --- a/Templates/app_local.dwt +++ b/Templates/app_local.dwt @@ -67,5 +67,8 @@ + + + diff --git a/Templates/jsp.app.dwt.jsp b/Templates/jsp.app.dwt.jsp index 5a679d95b..7adee404a 100644 --- a/Templates/jsp.app.dwt.jsp +++ b/Templates/jsp.app.dwt.jsp @@ -68,5 +68,8 @@ + + + \ No newline at end of file diff --git a/Templates/jsp.app_debug.dwt.jsp b/Templates/jsp.app_debug.dwt.jsp index 62d7fbc64..573c37764 100644 --- a/Templates/jsp.app_debug.dwt.jsp +++ b/Templates/jsp.app_debug.dwt.jsp @@ -68,5 +68,8 @@ + + + \ No newline at end of file diff --git a/Templates/jsp.app_local.dwt.jsp b/Templates/jsp.app_local.dwt.jsp index 7e023c441..db84f25eb 100644 --- a/Templates/jsp.app_local.dwt.jsp +++ b/Templates/jsp.app_local.dwt.jsp @@ -68,5 +68,8 @@ + + + \ No newline at end of file diff --git a/Templates/php.app.dwt.php b/Templates/php.app.dwt.php index 7f946bc07..1efa09b84 100644 --- a/Templates/php.app.dwt.php +++ b/Templates/php.app.dwt.php @@ -82,5 +82,8 @@ function wdnInclude($path) + + + diff --git a/Templates/php.app_debug.dwt.php b/Templates/php.app_debug.dwt.php index e92103ed7..39c2775c0 100644 --- a/Templates/php.app_debug.dwt.php +++ b/Templates/php.app_debug.dwt.php @@ -82,5 +82,8 @@ function wdnInclude($path) + + + diff --git a/Templates/php.app_local.dwt.php b/Templates/php.app_local.dwt.php index 5fa51db21..c272d5a53 100644 --- a/Templates/php.app_local.dwt.php +++ b/Templates/php.app_local.dwt.php @@ -82,5 +82,8 @@ function wdnInclude($path) + + +