diff options
| author | Shohei Yoshida <[email protected]> | 2020-06-25 17:35:53 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-06-25 11:35:53 +0300 |
| commit | fb4efb49ea7f5ebe36e67a457b8f713b2c5b2bb4 (patch) | |
| tree | bba998e1ba3249352518f535ad979eef116871c7 /js/src | |
| parent | 9f173aeff363b6b535e5d0956f210107456c2904 (diff) | |
| download | bootstrap-fb4efb49ea7f5ebe36e67a457b8f713b2c5b2bb4.tar.xz bootstrap-fb4efb49ea7f5ebe36e67a457b8f713b2c5b2bb4.zip | |
Prevent overflowing static backdrop modal animation (#30326)
Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/modal.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/js/src/modal.js b/js/src/modal.js index 0d15041bd..8c6617650 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -409,10 +409,23 @@ class Modal { return } + const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight + + if (!isModalOverflowing) { + this._element.style.overflowY = 'hidden' + } + this._element.classList.add(CLASS_NAME_STATIC) - const modalTransitionDuration = getTransitionDurationFromElement(this._element) + const modalTransitionDuration = getTransitionDurationFromElement(this._dialog) + EventHandler.off(this._element, TRANSITION_END) EventHandler.one(this._element, TRANSITION_END, () => { this._element.classList.remove(CLASS_NAME_STATIC) + if (!isModalOverflowing) { + EventHandler.one(this._element, TRANSITION_END, () => { + this._element.style.overflowY = '' + }) + emulateTransitionEnd(this._element, modalTransitionDuration) + } }) emulateTransitionEnd(this._element, modalTransitionDuration) this._element.focus() |
