From b81cddea9225db936121a60e6674ebbd30d2b945 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Thu, 17 Feb 2022 16:18:14 +0000 Subject: [PATCH] [FIX] website: not hide header partially when scrolling to snippet Since [1] only floating fixed headers were included in the calculation of the `dom.scrollTo()`'s offset. Because of this when a snippet was dropped on the top of a page, the header being shown but non-floating was not used in the offset calculation, which made the automatic scroll operation hide the header partially for headers taller than the requested 50px offset from the top of the display. After this commit, any shown header is included in that calculation - even non floating ones. Steps to reproduce: - drop snippets into the page until it has to scroll - drop a snippet right below the header => header was partially hidden upon drop by the automatic scolling [1]: https://github.com/odoo/odoo/commit/ee47bd9ce0da526ea5b3387a354ab8fbd06cc55f task-2765820 closes odoo/odoo#86038 X-original-commit: f3e51a7beb4b0d4ccb6a883d2c53bd303e94a200 Signed-off-by: Quentin Smetz (qsm) --- addons/website/static/src/js/content/menu.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/content/menu.js b/addons/website/static/src/js/content/menu.js index 97a92bd45ac..404a5710a5d 100644 --- a/addons/website/static/src/js/content/menu.js +++ b/addons/website/static/src/js/content/menu.js @@ -79,7 +79,9 @@ const BaseAnimatedHeader = animations.Animation.extend({ */ _adaptToHeaderChange: function () { this._updateMainPaddingTop(); - this.el.classList.toggle('o_top_fixed_element', this.fixedHeader && this._isShown()); + // Take menu into account when `dom.scrollTo()` is used whenever it is + // visible - be it floating, fully displayed or partially hidden. + this.el.classList.toggle('o_top_fixed_element', this._isShown()); for (const callback of extraMenuUpdateCallbacks) { callback();