From cef51e2a507f20dd69e66841650f93603aaaeb01 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Mon, 19 May 2014 14:01:47 +0200 Subject: [PATCH] [FIX]modal: in some particular case, we have 2 actions opening modal one after another, fix problem in those case where second modal was close instead of first one --- addons/web/static/src/js/chrome.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index f611d5bd502..19962029b9d 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -218,9 +218,13 @@ instance.web.Dialog = instance.web.Widget.extend({ //we need this to put the instruction to remove modal from DOM at the end //of the queue, otherwise it might already have been removed before the modal-backdrop //is removed when pressing escape key + var $element = this.$dialog_box; setTimeout(function () { - //remove last modal from list of opened modal since we just destroy it - opened_modal.pop().remove(); + //remove modal from list of opened modal since we just destroy it + var modal_list_index = $.inArray($element, opened_modal); + if (modal_list_index > -1){ + opened_modal.splice(modal_list_index,1)[0].remove(); + } if (opened_modal.length > 0){ //we still have other opened modal so we should focus it opened_modal[opened_modal.length-1].focus();