diff options
| author | Johann-S <[email protected]> | 2019-07-28 11:49:44 +0200 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2019-07-28 12:11:10 +0200 |
| commit | 2ea71a9e782000a5abe7916204ab694d993a9415 (patch) | |
| tree | 49706b02d920559c3e5359bac383f7c9cd2b67e5 /js/src/modal/modal.js | |
| parent | f4e297c878c89483d64f03381eb5c3f999083604 (diff) | |
| download | bootstrap-2ea71a9e782000a5abe7916204ab694d993a9415.tar.xz bootstrap-2ea71a9e782000a5abe7916204ab694d993a9415.zip | |
allow dynamic modal body for scrollable modals
Diffstat (limited to 'js/src/modal/modal.js')
| -rw-r--r-- | js/src/modal/modal.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/js/src/modal/modal.js b/js/src/modal/modal.js index a0e460f22..5d7424937 100644 --- a/js/src/modal/modal.js +++ b/js/src/modal/modal.js @@ -243,6 +243,7 @@ class Modal { _showElement(relatedTarget) { const transition = this._element.classList.contains(ClassName.FADE) + const modalBody = SelectorEngine.findOne(Selector.MODAL_BODY, this._dialog) if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { @@ -254,8 +255,8 @@ class Modal { this._element.removeAttribute('aria-hidden') this._element.setAttribute('aria-modal', true) - if (this._dialog.classList.contains(ClassName.SCROLLABLE)) { - SelectorEngine.findOne(Selector.MODAL_BODY, this._dialog).scrollTop = 0 + if (this._dialog.classList.contains(ClassName.SCROLLABLE) && modalBody) { + modalBody.scrollTop = 0 } else { this._element.scrollTop = 0 } |
