diff options
| author | Julien Mougenot <jum@odoo.com> | 2020-01-28 11:25:56 +0000 |
|---|---|---|
| committer | Julien Mougenot <jum@odoo.com> | 2020-01-28 11:35:14 +0000 |
| commit | 5f6571a6fec60fee9688eeda2c97c9bb15cc2e3b (patch) | |
| tree | 983710550d99d2415ff63afe75f7e8d5c2eb9ab0 /addons/web/static/src | |
| parent | a61332e251d8896fc8cc0959b080757d584dcb79 (diff) | |
[FIX] web,mail: only apply modal activity for Dialog modals
Before this commit, the CSS rule handling the "activity" of the modals
(their z-index compared to the one of their backdrop) was global and would
interfere with front-end or custom modals which do not use the static Dialog
methods giving them the "active" class.
Now, the rule has been inverted: the z-index of a modal is only changed when
it is given an "inactive" class, thus only impacting the modals instantiated
via Dialog or Owl Dialog classes.
closes odoo/odoo#44067
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/core/owl_dialog.js | 22 | ||||
| -rw-r--r-- | addons/web/static/src/scss/modal.scss | 4 |
2 files changed, 12 insertions, 14 deletions
diff --git a/addons/web/static/src/js/core/owl_dialog.js b/addons/web/static/src/js/core/owl_dialog.js index e6221e182c9..940c7c3b7d2 100644 --- a/addons/web/static/src/js/core/owl_dialog.js +++ b/addons/web/static/src/js/core/owl_dialog.js @@ -189,20 +189,18 @@ odoo.define('web.OwlDialog', function (require) { * @param {(LegacyDialog|OwlDialog)} dialog */ static display(dialog) { - // Deactivate previous dialog - const activeDialogEl = document.querySelector('.modal.o_active_modal'); - if (activeDialogEl) { - activeDialogEl.classList.remove('o_active_modal'); + const activeDialog = this.displayed[this.displayed.length - 1]; + if (activeDialog) { + // Deactivate previous dialog + const activeDialogEl = activeDialog instanceof this ? + // Owl dialog + activeDialog.modalRef.el : + // Legacy dialog + activeDialog.$modal[0]; + activeDialogEl.classList.add('o_inactive_modal'); } // Push dialog this.displayed.push(dialog); - // Add active class - const modalEl = dialog instanceof this ? - // Owl dialog - dialog.modalRef.el : - // Legacy dialog - dialog.$modal[0]; - modalEl.classList.add('o_active_modal'); // Update body class document.body.classList.add('modal-open'); } @@ -224,7 +222,7 @@ odoo.define('web.OwlDialog', function (require) { lastDialog.modalRef.el : // Legacy dialog lastDialog.$modal[0]; - modalEl.classList.add('o_active_modal'); + modalEl.classList.remove('o_inactive_modal'); } else { document.body.classList.remove('modal-open'); } diff --git a/addons/web/static/src/scss/modal.scss b/addons/web/static/src/scss/modal.scss index d82ddec6213..54bbbc2a696 100644 --- a/addons/web/static/src/scss/modal.scss +++ b/addons/web/static/src/scss/modal.scss @@ -106,8 +106,8 @@ } } -.modal:not(.o_active_modal) { - z-index: 1030; +.modal.o_inactive_modal { + z-index: $zindex-modal-backdrop - 1; } .o_dialog { |
