feat: add aria-label to sidebar notification count

This commit is contained in:
Kaushal Shriwas 2026-04-17 00:22:33 +05:30
parent 5f85777c8e
commit 7572e6fe45
2 changed files with 6 additions and 3 deletions

View file

@ -402,9 +402,12 @@ class NotificationsView extends BaseNotificationsView {
if (!$suffix?.length) return; if (!$suffix?.length) return;
if (count > 0) { if (count > 0) {
$suffix.text(count > 99 ? "99+" : count).removeClass("hidden"); $suffix
.text(count > 99 ? "99+" : count)
.attr("aria-label", __("{0} unread notifications", [count]))
.removeClass("hidden");
} else { } else {
$suffix.addClass("hidden"); $suffix.removeAttr("aria-label").addClass("hidden");
} }
} }

View file

@ -487,7 +487,7 @@ frappe.ui.Sidebar = class Sidebar {
standard: true, standard: true,
type: "Button", type: "Button",
class: "sidebar-notification hidden", class: "sidebar-notification hidden",
suffix: "<span class='sidebar-notification-count hidden'></span>", suffix: "<span class='sidebar-notification-count hidden' aria-live='polite'></span>",
onClick: () => { onClick: () => {
const $dropdown = this.wrapper.find(".dropdown-notifications"); const $dropdown = this.wrapper.find(".dropdown-notifications");
$dropdown.toggleClass("hidden"); $dropdown.toggleClass("hidden");