From 8a1603eedaa8366ba6fb6c97bb58368ed854f2db Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 12 Mar 2018 08:16:51 +0100 Subject: [PATCH] [FIX] web: don't scroll to top when opening a dialog Steps to reproduce the issue: on an MD sized screen (i.e. such that the chatter is below form views), go to a sale order in edit mode, scroll down and click on 'Add an item', a modal opens, and the form view behind scrolls back to the top, whereas it should keep its scroll position. This is because the ActionManager listens to event 'DOM UPDATED', and when it occurs, it restores the current action's scroll position (the main purpose is to restore the scroll position of a previously visited action to which we return using the breadcrumbs). When a dialog opens, this event is also triggered, but in this case we should not restore the scroll position of the action in the background. Fixes #23491 --- addons/web/static/src/js/chrome/action_manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js index e72db2c3a0c..905d9c1c3b9 100644 --- a/addons/web/static/src/js/chrome/action_manager.js +++ b/addons/web/static/src/js/chrome/action_manager.js @@ -283,7 +283,8 @@ var ActionManager = Widget.extend({ // Listen to event "DOM_updated" to restore the scroll position core.bus.on('DOM_updated', this, function() { - if (this.inner_action) { + // DO NOT FORWARDPORT THIS + if (this.inner_action && !$('.dialog').length) { this.trigger_up('scrollTo', {offset: this.inner_action.getScrollTop() || 0}); } });