diff --git a/addons/website/__manifest__.py b/addons/website/__manifest__.py index 037598a5ac8..e815f74b3da 100644 --- a/addons/website/__manifest__.py +++ b/addons/website/__manifest__.py @@ -131,6 +131,7 @@ 'website/static/src/scss/website_controller_page.scss', 'website/static/src/scss/website.ui.scss', 'website/static/src/libs/zoomodoo/zoomodoo.js', + 'website/static/src/libs/bootstrap/bootstrap.js', 'website/static/src/js/utils.js', 'web/static/src/core/autocomplete/*', 'website/static/src/components/autocomplete_with_pages/*', diff --git a/addons/website/static/src/libs/bootstrap/bootstrap.js b/addons/website/static/src/libs/bootstrap/bootstrap.js new file mode 100644 index 00000000000..7be751cd84f --- /dev/null +++ b/addons/website/static/src/libs/bootstrap/bootstrap.js @@ -0,0 +1,15 @@ +/** + * Grep `_detectNavbar`: the dynamic navbar's dropdown positioning was activated + * to prevent sub-menus overflow. This positioning will use the default BS + * offsets to position sub-menus leading to a small gap that hides them when + * hovered (on "Hover" mode). The goal here is to prevent this offset when the + * target is inside a navbar. + */ +const bsGetOffsetFunction = Dropdown.prototype._getOffset; +Dropdown.prototype._getOffset = function () { + const offset = bsGetOffsetFunction.apply(this, arguments); + if (this._element.closest(".o_hoverable_dropdown .navbar")) { + return [offset[0], 0]; + } + return offset; +};