diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js index c13bbbb56398d..170dab4002605 100644 --- a/addons/website/static/src/js/content/snippets.animation.js +++ b/addons/website/static/src/js/content/snippets.animation.js @@ -1459,7 +1459,7 @@ registry.WebsiteAnimate = publicWidget.Widget.extend({ */ start() { this.lastScroll = 0; - this.$scrollingElement = $().getScrollingElement(); + this.$scrollingElement = this.findScrollingElement(); this.$scrollingTarget = $().getScrollingTarget(this.$scrollingElement); this.$animatedElements = this.$('.o_animate'); @@ -1525,6 +1525,10 @@ registry.WebsiteAnimate = publicWidget.Widget.extend({ this.$scrollingElement[0].classList.remove('o_wanim_overflow_xy_hidden'); }, + findScrollingElement() { + return $().getScrollingElement(); + }, + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- diff --git a/addons/website_slides/__manifest__.py b/addons/website_slides/__manifest__.py index f849e50a38c08..b7d29cd3753b2 100644 --- a/addons/website_slides/__manifest__.py +++ b/addons/website_slides/__manifest__.py @@ -103,6 +103,7 @@ 'website_slides/static/src/js/slides_course_quiz_question_form.js', 'website_slides/static/src/js/slides_course_tag_add.js', 'website_slides/static/src/js/slides_course_unsubscribe.js', + 'website_slides/static/src/js/snippets.animation.js', 'website_slides/static/src/js/portal_rating_composer.js', 'website_slides/static/src/xml/website_slides_sidebar.xml', 'website_slides/static/src/xml/website_slides_fullscreen.xml', diff --git a/addons/website_slides/static/src/js/snippets.animation.js b/addons/website_slides/static/src/js/snippets.animation.js new file mode 100644 index 0000000000000..1af3779528a0e --- /dev/null +++ b/addons/website_slides/static/src/js/snippets.animation.js @@ -0,0 +1,22 @@ +/** @odoo-module **/ + +import publicWidget from '@web/legacy/js/public/public_widget'; +import '@website/js/content/snippets.animation'; + +publicWidget.registry.WebsiteAnimate.include({ + /** + * @override + * @todo This should be avoided: the natural scrollbar of the browser should + * always be preferred. Indeed, moving the main scroll of the page to a + * different location causes a lot of issues. See 189a7c96e6e26825dc05c0c64 + * for more information (improvement of 18.0 for general scrolling behaviors + * in all website pages). E.g. issue in eLearning: go to an article in full + * screen mode, try to use the up/down arrow keys to scroll: it does not + * work (you first have to focus the article which should not be needed as + * it is the only main scrollable element of the page). + */ + findScrollingElement() { + const articleContent = document.querySelector('.o_wslide_fs_article_content'); + return articleContent ? $(articleContent) : this._super(...arguments); + } +});