From b971b417c5dfc1c3fdafca49ba124ea254876bd3 Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Fri, 16 Oct 2020 10:26:52 +0000 Subject: [PATCH] [FIX] web_editor: disable overlay pointer events on wheel event This commit disable the pointer events on the overlay during the mouse wheel event. To prevent page scrolling from stopping when hovering over the overlay. task-2312878 closes odoo/odoo#60367 X-original-commit: 978cd02406495e7566cefb556276e2ac2292e3f8 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/editor/snippets.editor.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 308e54f4bc7..35e60a58998 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -46,6 +46,7 @@ var SnippetEditor = Widget.extend({ xmlDependencies: ['/web_editor/static/src/xml/snippets.xml'], events: { 'click .oe_snippet_remove': '_onRemoveClick', + 'wheel': '_onMouseWheel', }, custom_events: { 'option_update': '_onOptionUpdate', @@ -895,6 +896,21 @@ var SnippetEditor = Widget.extend({ } } }, + /** + * Called when the 'mouse wheel' is used when hovering over the overlay. + * Disable the pointer events to prevent page scrolling from stopping. + * + * @private + * @param {Event} ev + */ + _onMouseWheel: function (ev) { + ev.stopPropagation(); + this.$el.css('pointer-events', 'none'); + clearTimeout(this.wheelTimeout); + this.wheelTimeout = setTimeout(() => { + this.$el.css('pointer-events', ''); + }, 250); + }, }); /**