From 35edd8ea92477618fa8e6de2de38b1ca4981eace Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Mon, 8 Apr 2024 23:40:58 +0200 Subject: [PATCH] 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`. --- internal/ui/static/js/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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"); } }