[FIX] web_editor : hide dropdown on blur toolbar studio

Steps to reproduce:
===================
- Open any app (sales for example)
- Toggle studio
- select reports tab
- Select any report
- Select some text and open any dropdown (font size or color)
- Click somewhere else on the document
- Select some text again
- The dropdown stayed open from the first select

Origin of the issue:
====================
Clicking somewhere on the document in studio doesn't trigger the events
`defined in bootstrap/js/dist/dropdown.js` because of the iframe.

Solution:
=========
Trigger click event on toggle button for the opened dropdown when hiding
the toolbar to close them

task-3674736

closes odoo/odoo#154969

X-original-commit: 878f3b27966a278a9332ef43e827eb2006911583
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
This commit is contained in:
Mahdi Cheikh Rouhou (macr)
2024-02-22 11:14:55 +00:00
parent 35e807f424
commit 96d5302914
@@ -3136,6 +3136,9 @@ export class OdooEditor extends EventTarget {
this.toolbar.style.visibility = show ? 'visible' : 'hidden';
}
if (show === false) {
for (const menu of this.toolbar.querySelectorAll('.dropdown-menu.show')) {
menu.parentElement?.querySelector('[data-bs-toggle="dropdown"]')?.click();
};
return;
}
}