From 38e35cc4427af0a6ae11f5c1115c5c0f603eecb2 Mon Sep 17 00:00:00 2001
From: Nicolas Lempereur <nle@odoo.com>
Date: Thu, 12 May 2016 15:46:23 +0200
Subject: [PATCH] [FIX] web_editor: scroll and editing menu modal

The class modal-open on body tag allow to scroll on the modal content
which is useful if the content is taller than the window viewport.

When closing the modal, this class is removed but there may be another
modal open on which we will not be able to scroll to view
buttons/content if too big.

This commit check if a modal is still opened after closing an editor
modal and in the affirmative add back the modal-open class.

opw-674475

note : was already present in 8.0 with ec47493, it is also present for
web.Dialog (but the modal of the editor do not inherit from web.Dialog)
---
 addons/web_editor/static/src/js/widgets.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js
index 165f0b0e914e..7f9178afee4d 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -39,6 +39,10 @@ var Dialog = Widget.extend({
     close: function () {
         this.$el.modal('hide');
     },
+    destroy: function () {
+        this._super();
+        $("body:has('> .modal:visible')").addClass('modal-open');
+    },
     stop_escape: function(event) {
         if($(".modal.in").length>0 && event.which == 27){
             event.stopPropagation();
-- 
GitLab