From: Alexander Ebert Date: Fri, 12 Aug 2022 19:32:10 +0000 (+0200) Subject: Use a native button element instead X-Git-Tag: 6.0.0_Alpha_1~1024^2~2^2~55 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a77cd56ca918781faf384e6a4631cc1c638a98c1;p=GitHub%2FWoltLab%2FWCF.git Use a native button element instead --- diff --git a/com.woltlab.wcf/templates/notificationSettings.tpl b/com.woltlab.wcf/templates/notificationSettings.tpl index 30357d5aef..606394b75e 100644 --- a/com.woltlab.wcf/templates/notificationSettings.tpl +++ b/com.woltlab.wcf/templates/notificationSettings.tpl @@ -36,7 +36,7 @@
{if $event->supportsEmailNotification()} - + {/if}
diff --git a/ts/WoltLabSuite/Core/Ui/User/Menu/View.ts b/ts/WoltLabSuite/Core/Ui/User/Menu/View.ts index ef47b47c42..84e520e83c 100644 --- a/ts/WoltLabSuite/Core/Ui/User/Menu/View.ts +++ b/ts/WoltLabSuite/Core/Ui/User/Menu/View.ts @@ -251,21 +251,24 @@ export class UserMenuView { } private buildButton(button: UserMenuButton): HTMLElement { - const link = document.createElement("a"); - link.setAttribute("role", "button"); + let link: HTMLAnchorElement | HTMLButtonElement; + if (button.link === "#") { + link = document.createElement("button"); + } else { + link = document.createElement("a"); + link.href = button.link; + } + link.classList.add("userMenuButton", "jsTooltip"); link.title = button.title; link.innerHTML = button.icon; if (button.name === "markAllAsRead") { - link.href = "#"; link.addEventListener("click", (event) => { event.preventDefault(); void this.markAllAsRead(); }); - } else { - link.href = button.link; } return link; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Menu/View.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Menu/View.js index c27c8af7d2..9774ce04b1 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Menu/View.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Menu/View.js @@ -201,21 +201,23 @@ define(["require", "exports", "tslib", "../../../Date/Util", "../../../StringUti } } buildButton(button) { - const link = document.createElement("a"); - link.setAttribute("role", "button"); + let link; + if (button.link === "#") { + link = document.createElement("button"); + } + else { + link = document.createElement("a"); + link.href = button.link; + } link.classList.add("userMenuButton", "jsTooltip"); link.title = button.title; link.innerHTML = button.icon; if (button.name === "markAllAsRead") { - link.href = "#"; link.addEventListener("click", (event) => { event.preventDefault(); void this.markAllAsRead(); }); } - else { - link.href = button.link; - } return link; } async markAllAsRead() { diff --git a/wcfsetup/install/files/style/ui/userMenu.scss b/wcfsetup/install/files/style/ui/userMenu.scss index 838d37b58f..155b8da66f 100644 --- a/wcfsetup/install/files/style/ui/userMenu.scss +++ b/wcfsetup/install/files/style/ui/userMenu.scss @@ -77,10 +77,15 @@ .userMenuButton { align-items: center; + color: inherit; display: flex; height: 44px; justify-content: center; width: 44px; + + &:hover { + color: inherit; + } } html:not(.touch) .userMenuButton {