From 059841d870a707a2e8e32cdb7af6276cc1ec6fea Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Fri, 9 Jun 2023 11:11:16 +0000 Subject: [PATCH] [FIX] website: fix the scrolling of table of content in website slides Steps to reproduce the bug: - Install the Website Slides module. - Got to the /slides page. - Click on a course. - Click on the "Add Content" button. - Choose "Web Page" in the modal. - Once in edit mode, drag and drop a "Table of Content" snippet onto the page. - Save the page. - Scroll the page and observe that the navbar items are updated as you scroll. - Click on the "Fullscreen" button. - Bug: When scrolling the page, the navbar items are no longer updated as you scroll. This commit fixes the issue by detecting the scrolling element by traversing up the ancestors from the 'table of content' snippet, instead of using the 'getScrollingElement' function, which always returned the '#wrapwrap' when a Website Slides page is in fullscreen. opw-3302118 closes odoo/odoo#124935 X-original-commit: 1ac274c3cdddca3e6caf76d9b30b9efaa38bc09f Signed-off-by: Romain Derie (rde) Signed-off-by: Vray Benjamin (bvr) --- addons/website/static/src/snippets/s_table_of_content/000.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/snippets/s_table_of_content/000.js b/addons/website/static/src/snippets/s_table_of_content/000.js index 8f3f2233d76..fec0d2d1db0 100644 --- a/addons/website/static/src/snippets/s_table_of_content/000.js +++ b/addons/website/static/src/snippets/s_table_of_content/000.js @@ -13,7 +13,7 @@ const TableOfContent = publicWidget.Widget.extend({ async start() { this._stripNavbarStyles(); await this._super(...arguments); - this.$scrollingElement = $().getScrollingElement(); + this.$scrollingElement = this.$target.closest(".s_table_of_content").closestScrollable(); this.previousPosition = -1; this._updateTableOfContentNavbarPosition(); this._updateTableOfContentNavbarPositionBound = this._updateTableOfContentNavbarPosition.bind(this);