[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) <qsm@odoo.com>
This commit is contained in:
Benoit Socias
2022-03-08 16:48:46 +00:00
parent d0e0db3b8e
commit b81cddea92
+3 -1
View File
@@ -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();