From a4fff7c38397fa8fb59891cc94807be020ac37ec Mon Sep 17 00:00:00 2001 From: David Bailey Date: Mon, 28 Aug 2017 18:35:47 +0100 Subject: Fix unwanted body padding when a modal opens Prevents the test from failing --- js/src/modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src') diff --git a/js/src/modal.js b/js/src/modal.js index ab73230c8..a88c14444 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -426,7 +426,7 @@ const Modal = (($) => { } _checkScrollbar() { - this._isBodyOverflowing = document.body.clientWidth < window.innerWidth + this._isBodyOverflowing = document.body.offsetWidth < window.innerWidth this._scrollbarWidth = this._getScrollbarWidth() } -- cgit v1.2.3 From 2725acc9e576059e2dbb3e4722dd5beef84e9215 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Mon, 28 Aug 2017 18:44:56 +0100 Subject: Use jQuery outerWidth instead of offsetWidth --- js/src/modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src') diff --git a/js/src/modal.js b/js/src/modal.js index a88c14444..c8c7e3d21 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -426,7 +426,7 @@ const Modal = (($) => { } _checkScrollbar() { - this._isBodyOverflowing = document.body.offsetWidth < window.innerWidth + this._isBodyOverflowing = $('body').outerWidth(true) < window.innerWidth this._scrollbarWidth = this._getScrollbarWidth() } -- cgit v1.2.3 From 3f2a8db4711e420b48b7a5b4c36f158a1b9eabab Mon Sep 17 00:00:00 2001 From: David Bailey Date: Mon, 28 Aug 2017 18:55:45 +0100 Subject: Use getBoundingClientRect instead of jQuery --- js/src/modal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/src') diff --git a/js/src/modal.js b/js/src/modal.js index c8c7e3d21..0306b4e87 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -426,7 +426,8 @@ const Modal = (($) => { } _checkScrollbar() { - this._isBodyOverflowing = $('body').outerWidth(true) < window.innerWidth + const rect = document.body.getBoundingClientRect() + this._isBodyOverflowing = rect.left + rect.right < window.innerWidth this._scrollbarWidth = this._getScrollbarWidth() } -- cgit v1.2.3