Signed by hannaSSH key fingerprint: SHA256:4g9cWhkAAw8gwqhJUcVbSnGEvdGwklW+1Aa/fMUu59k
assets/fabrica.js +13 −0
| @@ -46,6 +46,16 @@ | |||
| 46 | 46 | if (picker.form) picker.form.submit(); | |
| 47 | 47 | }); | |
| 48 | 48 | ||
| 49 | + | // ---- Dropdowns (details-based popovers) ---- | |
| 50 | + | // Native <details> stays open until its summary is clicked again; close any | |
| 51 | + | // open menu when a click lands outside it. Without JS the menus still work, | |
| 52 | + | // they just close on a second summary click. | |
| 53 | + | document.addEventListener("click", function (e) { | |
| 54 | + | document.querySelectorAll("details.clone-menu[open], details.branch-menu[open]").forEach(function (d) { | |
| 55 | + | if (!d.contains(e.target)) d.removeAttribute("open"); | |
| 56 | + | }); | |
| 57 | + | }); | |
| 58 | + | ||
| 49 | 59 | // ---- Clipboard buttons ---- | |
| 50 | 60 | document.addEventListener("click", function (e) { | |
| 51 | 61 | var btn = e.target.closest("[data-clipboard]"); | |
| @@ -81,6 +91,9 @@ | |||
| 81 | 91 | } | |
| 82 | 92 | } else if (e.key === "Escape") { | |
| 83 | 93 | toggleDrawer(false); | |
| 94 | + | document.querySelectorAll("details.clone-menu[open], details.branch-menu[open]").forEach(function (d) { | |
| 95 | + | d.removeAttribute("open"); | |
| 96 | + | }); | |
| 84 | 97 | } | |
| 85 | 98 | }); | |
| 86 | 99 | })(); | |