From cfaec434c055690c1387beb434ae3d7af3e616ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Brenckl=C3=A9?= Date: Thu, 27 Oct 2022 14:04:22 +0200 Subject: [PATCH] :children_crossing: Close dropdown when opening modal item --- bookwyrm/static/js/bookwyrm.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index 95271795d..aa06a8b0a 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -38,11 +38,12 @@ let BookWyrm = new (class { .querySelectorAll("[data-modal-open]") .forEach((node) => node.addEventListener("click", this.handleModalButton.bind(this))); - document - .querySelectorAll("details.dropdown") - .forEach((node) => - node.addEventListener("toggle", this.handleDetailsDropdown.bind(this)) + document.querySelectorAll("details.dropdown").forEach((node) => { + node.addEventListener("toggle", this.handleDetailsDropdown.bind(this)); + node.querySelectorAll("[data-modal-open]").forEach((modal_node) => + modal_node.addEventListener("click", () => (node.open = false)) ); + }); document .querySelector("#barcode-scanner-modal")