diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-06-25 15:40:30 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2020-07-06 16:40:27 +0300 |
commit | ea01c29294f3c70d74783f19c5f7406bd5ddbe9a (patch) | |
tree | 7e21e4c17d418f0b82cc633e9bf8597cb65681b0 /js/src/modal.js | |
parent | 234dd96abf602da776c89b6ee42618b50e67c168 (diff) |
Backport #30326
Prevent overflowing static backdrop modal animation
TODO: backport the test too
Diffstat (limited to 'js/src/modal.js')
-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 0a2d99a032..ec44929f07 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -238,12 +238,25 @@ 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 = Util.getTransitionDurationFromElement(this._element) + const modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog) + $(this._element).off(Util.TRANSITION_END) $(this._element).one(Util.TRANSITION_END, () => { this._element.classList.remove(CLASS_NAME_STATIC) + if (!isModalOverflowing) { + $(this._element).one(Util.TRANSITION_END, () => { + this._element.style.overflowY = '' + }) + .emulateTransitionEnd(this._element, modalTransitionDuration) + } }) .emulateTransitionEnd(modalTransitionDuration) this._element.focus() |