diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-09-24 11:33:35 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-09-24 11:33:35 +0000 |
| commit | ebd0c90a146145079061e79c2d4c37fa182a2975 (patch) | |
| tree | 5ae193c2029790f43e7c54a0771647f4f6bb34d3 /addons/web/static/src/js/libs/bootstrap.js | |
| parent | b94f54b5cdcbb58300a643a9c39f8c9d4842e41b (diff) | |
[FIX] website, *: review modal behaviors with right-panelization
*: web, web_editor
Since the right-panelization made with [1], the modals were not
compensating the body scrollbar when opened anymore and the backdrop
was misplaced. This commit fixes the problems generically, to support
modals with non-body scrolling.
[1]: https://github.com/odoo/odoo/pull/57975
closes odoo/odoo#58414
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/libs/bootstrap.js')
| -rw-r--r-- | addons/web/static/src/js/libs/bootstrap.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/addons/web/static/src/js/libs/bootstrap.js b/addons/web/static/src/js/libs/bootstrap.js index 07e04c64a39..3e2962cc490 100644 --- a/addons/web/static/src/js/libs/bootstrap.js +++ b/addons/web/static/src/js/libs/bootstrap.js @@ -96,6 +96,24 @@ $.fn.scrollspy.Constructor.prototype.refresh = function () { } }; +/* Bootstrap modal scrollbar compensation on non-body */ +const bsSetScrollbarFunction = $.fn.modal.Constructor.prototype._setScrollbar; +$.fn.modal.Constructor.prototype._setScrollbar = function () { + const $scrollable = $().getScrollingElement(); + if (document.body.contains($scrollable[0])) { + $scrollable.compensateScrollbar(true); + } + return bsSetScrollbarFunction.apply(this, arguments); +}; +const bsResetScrollbarFunction = $.fn.modal.Constructor.prototype._resetScrollbar; +$.fn.modal.Constructor.prototype._resetScrollbar = function () { + const $scrollable = $().getScrollingElement(); + if (document.body.contains($scrollable[0])) { + $scrollable.compensateScrollbar(false); + } + return bsResetScrollbarFunction.apply(this, arguments); +}; + return { makeExtendedSanitizeWhiteList: makeExtendedSanitizeWhiteList, }; |
