summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/libs/bootstrap.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/libs/bootstrap.js')
-rw-r--r--addons/web/static/src/js/libs/bootstrap.js18
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,
};