diff options
author | 2024-04-08 23:40:58 +0200 | |
---|---|---|
committer | 2024-04-09 20:36:42 -0700 | |
commit | 35edd8ea92477618fa8e6de2de38b1ca4981eace (patch) | |
tree | 64349385addbf191bc5adc748cdd043ed4893749 | |
parent | f0cb04188588531eb24f56ebfa79f9f05cda8dc3 (diff) | |
download | v2-35edd8ea92477618fa8e6de2de38b1ca4981eace.tar.gz v2-35edd8ea92477618fa8e6de2de38b1ca4981eace.tar.zst v2-35edd8ea92477618fa8e6de2de38b1ca4981eace.zip |
Fix clicking unread counter
When clicking the unread counter, the following exception occurs:
```
Uncaught TypeError: Cannot read properties of null (reading 'getAttribute')
```
This is due to `onClickMainMenuListItem` not working correctly for the
unread counter `span`s, which return `null` when using `querySelector`.
-rw-r--r-- | internal/ui/static/js/app.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/ui/static/js/app.js b/internal/ui/static/js/app.js index 79ffb4b5..02911194 100644 --- a/internal/ui/static/js/app.js +++ b/internal/ui/static/js/app.js @@ -86,7 +86,8 @@ function onClickMainMenuListItem(event) { if (element.tagName === "A") { window.location.href = element.getAttribute("href"); } else { - window.location.href = element.querySelector("a").getAttribute("href"); + const linkElement = element.querySelector("a") || element.closest("a"); + window.location.href = linkElement.getAttribute("href"); } } |