aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2024-03-08 14:01:03 -0500
committertdro <tdro@noreply.example.com>2024-03-08 14:01:03 -0500
commit7880038d9577fb0a14a30d2f7fab9f25304d8fd1 (patch)
treeb616c35bd481c6b3906eaf52c6fd541caf4bd44e /assets
parent4e74a82ddfc1ad27d58295e9bae4f8e5ab5bb604 (diff)
downloadcanory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.tar.gz
canory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.tar.bz2
canory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.zip
static/js/forms: Handle child in summary details
Diffstat (limited to 'assets')
-rw-r--r--assets/js/index.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index e43c011..e8e307a 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -730,8 +730,11 @@
sessionStorage[details.id] === "false" && details.removeAttribute("open");
sessionStorage[details.id] === "true" && details.setAttribute("open", true);
child.addEventListener("click", function(event) {
- let details = event.target.parentElement;
- sessionStorage[details.id] = !details.open;
+ let child = event.target.nodeName === "SUMMARY" && event.target || event.target.parentElement;
+ let details = child.parentElement;
+ if (details.id && details.nodeName === "DETAILS") {
+ sessionStorage[details.id] = !details.open;
+ }
});
}
}