diff options
| author | Johann-S <[email protected]> | 2019-07-28 12:19:00 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2019-07-31 11:37:39 +0300 |
| commit | e4d4c5d0bc9f5560e730ec3df06a538400e6ff6d (patch) | |
| tree | 59aadaee27bf1c197f8cac00f410a092d3c25e2b /js/src | |
| parent | 8f95b26d65717a208db0ff60e3c5fa43db4ef6d3 (diff) | |
| download | bootstrap-e4d4c5d0bc9f5560e730ec3df06a538400e6ff6d.tar.xz bootstrap-e4d4c5d0bc9f5560e730ec3df06a538400e6ff6d.zip | |
Backport #29155
allow dynamic modal body for scrollable modals
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/modal.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/js/src/modal.js b/js/src/modal.js index 99fe1bf2d..d6abfdec8 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -236,6 +236,7 @@ class Modal { _showElement(relatedTarget) { const transition = $(this._element).hasClass(ClassName.FADE) + const modalBody = this._dialog ? this._dialog.querySelector(Selector.MODAL_BODY) : null if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { @@ -247,8 +248,8 @@ class Modal { this._element.removeAttribute('aria-hidden') this._element.setAttribute('aria-modal', true) - if ($(this._dialog).hasClass(ClassName.SCROLLABLE)) { - this._dialog.querySelector(Selector.MODAL_BODY).scrollTop = 0 + if ($(this._dialog).hasClass(ClassName.SCROLLABLE) && modalBody) { + modalBody.scrollTop = 0 } else { this._element.scrollTop = 0 } |
