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

This commit is contained in:
Kris 2023-02-10 13:11:20 -05:00 committed by GitHub
parent 827df072a6
commit 3e826a67d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -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"),
},
})
);
}