-
- Downloads
[FIX] web, website: restore the use of the scroll to top button
Steps to reproduce the bug:
- Go to the website and edit a page.
- Make sure there is enough content to be able to scroll the page.
- Go to the "Theme" tab and disable the "Show Header" option.
- Click on the footer and enable the "Scroll Top Button".
- Click on "Save".
=> Clicking on the "Scroll To Top" button does nothing.
The "Scroll To Top" button is an anchor with its `href` set to `#top`.
By disabling the "Show Header" option, the header is removed from the
DOM and there is no existing element with `id=top` anymore. To fix
this, the `scrollTo` function has been patched in order to be able to
receive selectors as arguments. In the '#top' and '#bottom' case, those
positions are known and always the same (either at the top of the
document or the bottom of it) so there is no need to have the header or
the footer present in the DOM in order to be able to scroll up to those
positions.
Now that the `scrollTo` function is able to scroll to the top or the
bottom of the page even without header or footer, those two positions
can always be suggested as internal link anchors during link edition.
opw-3133464
closes odoo/odoo#113117
Signed-off-by:
Quentin Smetz (qsm) <qsm@odoo.com>
Showing
- addons/web/static/src/js/core/dom.js 18 additions, 8 deletionsaddons/web/static/src/js/core/dom.js
- addons/website/static/src/js/content/snippets.animation.js 13 additions, 0 deletionsaddons/website/static/src/js/content/snippets.animation.js
- addons/website/static/src/js/utils.js 12 additions, 1 deletionaddons/website/static/src/js/utils.js