From 5bf6a84e4f2d41f38ebc08209cf08233e6dad9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Mon, 24 Jul 2023 10:31:05 +0000 Subject: [PATCH] [FIX] mail: edit follower subtype should close dropdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, when editing subtype of a follower (click on pencil icon to edit), the subtype dialog was displayed while keeping the follower list dropdown open. This happens because `FollowerList` makes use of `Dropdown` and `DropdownItem`, and by default they manage closing of dropdown item when clicking away of when clicking on the dropdown item. However, when there are specific clickable elements on the `DropdownItem`, the clicks do not auto-close the dropdown menu. This commit fixes the issue by specifically close the dropdown menu when clicking on edit button of a follower in follower list. Task-3435443 closes odoo/odoo#129413 X-original-commit: a33f60356ba7c12bd854eb0efe5c653ff1559495 Signed-off-by: Sébastien Theys (seb) Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/core/web/follower_list.js | 1 + addons/mail/static/tests/web/follower_tests.js | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/mail/static/src/core/web/follower_list.js b/addons/mail/static/src/core/web/follower_list.js index ebb29c519eb..ea636dada6f 100644 --- a/addons/mail/static/src/core/web/follower_list.js +++ b/addons/mail/static/src/core/web/follower_list.js @@ -69,6 +69,7 @@ export class FollowerList extends Component { follower, onFollowerChanged: () => this.props.onFollowerChanged?.(), }); + document.body.click(); // hack to close dropdown } /** diff --git a/addons/mail/static/tests/web/follower_tests.js b/addons/mail/static/tests/web/follower_tests.js index 6adc967f566..228334e7456 100644 --- a/addons/mail/static/tests/web/follower_tests.js +++ b/addons/mail/static/tests/web/follower_tests.js @@ -121,6 +121,7 @@ QUnit.test("click on edit follower", async (assert) => { assert.containsOnce($, "button[title='Edit subscription']"); await click("button[title='Edit subscription']"); + assert.containsNone($, ".o-mail-Follower"); assert.verifySteps(["fetch_subtypes"]); assert.containsOnce($, ".o-mail-FollowerSubtypeDialog"); });