mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 824785 - social toolbar buttons should have an aria-label. r=jaws
This commit is contained in:
parent
8537c03508
commit
2cf3e9c328
@ -908,8 +908,13 @@ var SocialToolbar = {
|
||||
toolbarButton.setAttribute("tooltiptext", icon.label);
|
||||
|
||||
let badge = icon.counter || "";
|
||||
if (toolbarButton.getAttribute("badge") != badge)
|
||||
toolbarButton.setAttribute("badge", badge);
|
||||
toolbarButton.setAttribute("badge", badge);
|
||||
let ariaLabel = icon.label;
|
||||
// if there is a badge value, we must use a localizable string to insert it.
|
||||
if (badge)
|
||||
ariaLabel = gNavigatorBundle.getFormattedString("social.aria.toolbarButtonBadgeText",
|
||||
[ariaLabel, badge]);
|
||||
toolbarButton.setAttribute("aria-label", ariaLabel);
|
||||
}
|
||||
let socialToolbarItem = document.getElementById("social-toolbar-item");
|
||||
socialToolbarItem.appendChild(toolbarButtons);
|
||||
|
@ -110,11 +110,15 @@ var tests = {
|
||||
}, function () {
|
||||
let badge = statusIcon.getAttribute("badge");
|
||||
is(badge, "42", "status value is correct");
|
||||
// If there is a counter, the aria-label should reflect it.
|
||||
is(statusIcon.getAttribute("aria-label"), "Test Ambient 1 \u2046 (42)");
|
||||
|
||||
ambience.counter = 0;
|
||||
Social.provider.setAmbientNotification(ambience);
|
||||
badge = statusIcon.getAttribute("badge");
|
||||
is(badge, "", "status value is correct");
|
||||
// If there is no counter, the aria-label should be the same as the label
|
||||
is(statusIcon.getAttribute("aria-label"), "Test Ambient 1 \u2046");
|
||||
|
||||
// The menu bar isn't as easy to instrument on Mac.
|
||||
if (navigator.platform.contains("Mac"))
|
||||
|
@ -399,6 +399,9 @@ social.error.ok.accesskey=O
|
||||
social.error.closeSidebar.label=Close This Sidebar
|
||||
social.error.closeSidebar.accesskey=C
|
||||
|
||||
# LOCALIZATION NOTE: %1$S is the label for the toolbar button, %2$S is the associated badge numbering that the social provider may provide.
|
||||
social.aria.toolbarButtonBadgeText=%1$S (%2$S)
|
||||
|
||||
# Identity notifications popups
|
||||
identity.termsOfService = Terms of Service
|
||||
identity.privacyPolicy = Privacy Policy
|
||||
|
Loading…
Reference in New Issue
Block a user