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`.
This commit is contained in:
Michael Kuhn 2024-04-08 23:40:58 +02:00 committed by Frédéric Guillot
parent f0cb041885
commit 35edd8ea92

View file

@ -86,7 +86,8 @@ function onClickMainMenuListItem(event) {
if (element.tagName === "A") { if (element.tagName === "A") {
window.location.href = element.getAttribute("href"); window.location.href = element.getAttribute("href");
} else { } else {
window.location.href = element.querySelector("a").getAttribute("href"); const linkElement = element.querySelector("a") || element.closest("a");
window.location.href = linkElement.getAttribute("href");
} }
} }