[FIX] mail: edit follower subtype should close dropdown

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) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2023-07-24 23:04:00 +02:00
parent a669cad446
commit 5bf6a84e4f
2 changed files with 2 additions and 0 deletions
@@ -69,6 +69,7 @@ export class FollowerList extends Component {
follower,
onFollowerChanged: () => this.props.onFollowerChanged?.(),
});
document.body.click(); // hack to close dropdown
}
/**
@@ -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");
});