summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/components/dropdown_menu.js
diff options
context:
space:
mode:
authorRomain Estievenart <res@odoo.com>2021-01-28 14:01:32 +0000
committerRomain Estievenart <res@odoo.com>2021-02-01 10:50:51 +0000
commit7cb24db622b231b89558755d9c0e7d899fc994bf (patch)
treee11d05e51e91f8f009dac2ec89e3cce17d2ac600 /addons/web/static/src/js/components/dropdown_menu.js
parentee4f7df8d34593bdde3fc6f9bd062f6dad238fcb (diff)
[FIX] web: Auto close dropdown is broken
Steps to reproduce: 1. Go to Project App 2. Open and edit a task 3. Click on Customer => search more 5. Click on "Filters" 6. Click on "Group by" => The "Filters" and "Group by" dropdown are open at same time => bug Since odoo/odoo@e4f87710e16357f24f388159a7b1e82eccda598a, we added a way to prevent bs and owl dropdown to be open in the same time. But when the web-editor is present, the CSS selector used to match the opened modal ("search more" in this case) conflicts with the DOM created by the web-editor (modals identified by the classes: .web-editor, .note-picture-dialog, .note-link-dialog, .note-help-dialog). To avoid this conflict, this commit uses a more restrictive CSS selector to match only the first (active) opened modal (as web-editor doesn't attach its modals at the root of the body). closes odoo/odoo#65274 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/components/dropdown_menu.js')
-rw-r--r--addons/web/static/src/js/components/dropdown_menu.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/addons/web/static/src/js/components/dropdown_menu.js b/addons/web/static/src/js/components/dropdown_menu.js
index 8c1676d8952..890d928b19f 100644
--- a/addons/web/static/src/js/components/dropdown_menu.js
+++ b/addons/web/static/src/js/components/dropdown_menu.js
@@ -128,8 +128,12 @@ odoo.define('web.DropdownMenu', function (require) {
) {
if (document.body.classList.contains("modal-open")) {
// retrieve the active modal and check if the dropdown is a child of this modal
- const modal = document.querySelector('.modal:not(.o_inactive_modal)');
- if (!modal.contains(this.el)) {
+ const modal = document.querySelector('body > .modal:not(.o_inactive_modal)');
+ if (modal && !modal.contains(this.el)) {
+ return;
+ }
+ const owlModal = document.querySelector('body > .o_dialog > .modal:not(.o_inactive_modal)');
+ if (owlModal && !owlModal.contains(this.el)) {
return;
}
}