diff --git a/addons/web/static/src/legacy/js/core/dom.js b/addons/web/static/src/legacy/js/core/dom.js index d1936859653..062e9bb0a1f 100644 --- a/addons/web/static/src/legacy/js/core/dom.js +++ b/addons/web/static/src/legacy/js/core/dom.js @@ -529,7 +529,10 @@ var dom = { return size; }, /** - * @param {HTMLElement} el - the element to stroll to + * @param {HTMLElement} el - the element to stroll to (limitation: if the + * element is using a fixed position, this function cannot work except + * if is the header (with the "top" id) or the footer (with the + * "bottom" id) for which exceptions have been made) * @param {number} [options] - same as animate of jQuery * @param {number} [options.extraOffset=0] * extra offset to add on top of the automatic one (the automatic one @@ -555,6 +558,13 @@ var dom = { const isTopScroll = $scrollable.is($topLevelScrollable); function _computeScrollTop() { + if (el.id === 'top') { + return 0; + } + if (el.id === 'bottom') { + return $scrollable[0].scrollHeight - $scrollable[0].clientHeight; + } + let offsetTop = $el.offset().top; if (el.classList.contains('d-none')) { el.classList.remove('d-none');