diff options
author | tdro <tdro@noreply.example.com> | 2024-03-08 14:01:03 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2024-03-08 14:01:03 -0500 |
commit | 7880038d9577fb0a14a30d2f7fab9f25304d8fd1 (patch) | |
tree | b616c35bd481c6b3906eaf52c6fd541caf4bd44e /static/js | |
parent | 4e74a82ddfc1ad27d58295e9bae4f8e5ab5bb604 (diff) | |
download | canory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.tar.gz canory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.tar.bz2 canory-7880038d9577fb0a14a30d2f7fab9f25304d8fd1.zip |
static/js/forms: Handle child in summary details
Diffstat (limited to 'static/js')
-rw-r--r-- | static/js/forms.ts | 10 |
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; + } }); } } |