aboutsummaryrefslogtreecommitdiff
path: root/static
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 /static
parent4e74a82ddfc1ad27d58295e9bae4f8e5ab5bb604 (diff)
downloadcanory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.tar.gz
canory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.tar.bz2
canory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.zip
static/js/forms: Handle child in summary details
Diffstat (limited to 'static')
-rw-r--r--static/js/forms.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/static/js/forms.ts b/static/js/forms.ts
index e35a4b2..4784b20 100644
--- a/static/js/forms.ts
+++ b/static/js/forms.ts
@@ -58,11 +58,15 @@
if (details.id && details.nodeName === "DETAILS") {
sessionStorage[details.id] === "false" && details.removeAttribute("open");
- sessionStorage[details.id] === "true" && details.setAttribute("open", true);
+ 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;
+ }
});
}
}