[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
This commit is contained in:
Aaron Bohy
2018-03-12 12:55:40 +01:00
parent f02cd2977e
commit 8a1603eeda
@@ -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});
}
});