Skip to content

A platform for community discussion. Free, open, simple.

A11Y: add aria-label to header notification counts (#20231)

Kris3e826a67d16f
diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.js
index 01c19101121..387d01c309e 100644
--- a/app/assets/javascripts/discourse/app/widgets/header.js
+++ b/app/assets/javascripts/discourse/app/widgets/header.js
@@ -95,6 +95,14 @@ createWidget("header-notifications", {
titleOptions: {
count: user.new_personal_messages_notifications_count,
},
+ attributes: {
+ "aria-label": I18n.t(
+ "notifications.tooltip.new_message_notification",
+ {
+ count: user.new_personal_messages_notifications_count,
+ }
+ ),
+ },
})
);
} else if (user.unseen_reviewable_count) {
@@ -106,6 +114,11 @@ createWidget("header-notifications", {
omitSpan: true,
title: "notifications.tooltip.new_reviewable",
titleOptions: { count: user.unseen_reviewable_count },
+ attributes: {
+ "aria-label": I18n.t("notifications.tooltip.new_reviewable", {
+ count: user.unseen_reviewable_count,
+ }),
+ },
})
);
} else if (user.all_unread_notifications_count) {
@@ -118,6 +131,9 @@ createWidget("header-notifications", {
omitSpan: true,
title: "notifications.tooltip.regular",
titleOptions: { count: user.all_unread_notifications_count },
+ attributes: {
+ "aria-label": I18n.t("user.notifications"),
+ },
})
);
}