From 35f80bb12e4e71fd777ee60ffa43711d8f84b1a6 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 10 Aug 2017 20:56:35 -0700 Subject: bump to beta --- js/src/modal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/src/modal.js') diff --git a/js/src/modal.js b/js/src/modal.js index 02d463945..9f17fafc8 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -3,7 +3,7 @@ import Util from './util' /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.6): modal.js + * Bootstrap (v4.0.0-beta): modal.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -18,7 +18,7 @@ const Modal = (($) => { */ const NAME = 'modal' - const VERSION = '4.0.0-alpha.6' + const VERSION = '4.0.0-beta' const DATA_KEY = 'bs.modal' const EVENT_KEY = `.${DATA_KEY}` const DATA_API_KEY = '.data-api' -- cgit v1.2.3 From ef8c77d8dcebd13559a141e419d003c2d10cc5f3 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 27 Jul 2017 13:39:55 +0300 Subject: Tweak ESLint rules. --- js/src/modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/modal.js') diff --git a/js/src/modal.js b/js/src/modal.js index 9f17fafc8..d21a137fb 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -507,7 +507,7 @@ const Modal = (($) => { } if (typeof config === 'string') { - if (data[config] === undefined) { + if (typeof data[config] === 'undefined') { throw new Error(`No method named "${config}"`) } data[config](relatedTarget) -- cgit v1.2.3 From ba6a6f13691000ffaf22ef8e731513737659447f Mon Sep 17 00:00:00 2001 From: David Bailey Date: Fri, 25 Aug 2017 22:01:41 +0100 Subject: Fix sticky margin when a modal is opened (#23669) * Adjust margin for sticky elements on modal Previously white space was visible to the right of sticky elements due to right padding being added to the body. This fixes #23661. * Add unit tests for margin of sticky elements on modal --- js/src/modal.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'js/src/modal.js') diff --git a/js/src/modal.js b/js/src/modal.js index d21a137fb..ab73230c8 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -68,6 +68,7 @@ const Modal = (($) => { DATA_TOGGLE : '[data-toggle="modal"]', DATA_DISMISS : '[data-dismiss="modal"]', FIXED_CONTENT : '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', + STICKY_CONTENT : '.sticky-top', NAVBAR_TOGGLER : '.navbar-toggler' } @@ -441,6 +442,13 @@ const Modal = (($) => { $(element).data('padding-right', actualPadding).css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`) }) + // Adjust sticky content margin + $(Selector.STICKY_CONTENT).each((index, element) => { + const actualMargin = $(element)[0].style.marginRight + const calculatedMargin = $(element).css('margin-right') + $(element).data('margin-right', actualMargin).css('margin-right', `${parseFloat(calculatedMargin) - this._scrollbarWidth}px`) + }) + // Adjust navbar-toggler margin $(Selector.NAVBAR_TOGGLER).each((index, element) => { const actualMargin = $(element)[0].style.marginRight @@ -464,8 +472,8 @@ const Modal = (($) => { } }) - // Restore navbar-toggler margin - $(Selector.NAVBAR_TOGGLER).each((index, element) => { + // Restore sticky content and navbar-toggler margin + $(`${Selector.STICKY_CONTENT}, ${Selector.NAVBAR_TOGGLER}`).each((index, element) => { const margin = $(element).data('margin-right') if (typeof margin !== 'undefined') { $(element).css('margin-right', margin).removeData('margin-right') -- cgit v1.2.3 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/modal.js') 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/modal.js') 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/modal.js') 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 From cbaf7a7b79c78ec7d877f348d12102acde6adfa0 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Tue, 29 Aug 2017 15:42:58 +0100 Subject: Fix failing test _adjustDialog should be called when the modal is first displayed to prevent it jumping position when the viewport is resized --- js/src/modal.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/src/modal.js') diff --git a/js/src/modal.js b/js/src/modal.js index ab73230c8..5892ed045 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -135,6 +135,8 @@ const Modal = (($) => { this._checkScrollbar() this._setScrollbar() + this._adjustDialog() + $(document.body).addClass(ClassName.OPEN) this._setEscapeEvent() -- cgit v1.2.3 From 9936bf59444c402b653f28449529eab83794e911 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Tue, 29 Aug 2017 21:16:00 +0200 Subject: Create a bundled release of Bootstrap with Popper.js inside --- js/src/modal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/src/modal.js') diff --git a/js/src/modal.js b/js/src/modal.js index ab73230c8..2ff93342d 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -1,3 +1,4 @@ +import $ from 'jquery' import Util from './util' @@ -8,7 +9,7 @@ import Util from './util' * -------------------------------------------------------------------------- */ -const Modal = (($) => { +const Modal = (() => { /** -- cgit v1.2.3 From b29b1e155880ac953899889c9cbb67f7f7df0529 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Tue, 3 Oct 2017 14:27:36 +0200 Subject: Use imported jQuery object --- js/src/modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/modal.js') diff --git a/js/src/modal.js b/js/src/modal.js index 689e93bc1..fb787208d 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -585,6 +585,6 @@ const Modal = (() => { return Modal -})(jQuery) +})($) export default Modal -- cgit v1.2.3