Bug 805206 - Keyboard accessible menuitem has a blank label. r=felipe, a=lsblakk

This commit is contained in:
Jared Wein 2012-10-25 12:30:59 -07:00
Родитель 6ca2dedd6f
Коммит ae3df05afa
1 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -98,6 +98,11 @@ let SocialUI = {
toggleCommand.setAttribute("label", label); toggleCommand.setAttribute("label", label);
toggleCommand.setAttribute("accesskey", accesskey); toggleCommand.setAttribute("accesskey", accesskey);
let kbMenuitem = document.getElementById("menu_socialAmbientMenu");
kbMenuitem.hidden = !Social.enabled;
kbMenuitem.setAttribute("label", label);
kbMenuitem.setAttribute("accesskey", accesskey);
SocialToolbar.init(); SocialToolbar.init();
SocialShareButton.init(); SocialShareButton.init();
SocialSidebar.init(); SocialSidebar.init();
@ -623,14 +628,17 @@ var SocialMenu = {
let ambientMenuItems = submenu.getElementsByClassName("ambient-menuitem"); let ambientMenuItems = submenu.getElementsByClassName("ambient-menuitem");
for (let ambientMenuItem of ambientMenuItems) for (let ambientMenuItem of ambientMenuItems)
submenu.removeChild(ambientMenuItem); submenu.removeChild(ambientMenuItem);
let separator = document.getElementById("socialAmbientMenuSeparator");
separator.hidden = true;
let provider = Social.provider; let provider = Social.provider;
if (Social.active && provider) { if (Social.active && provider) {
let iconNames = Object.keys(provider.ambientNotificationIcons); let iconNames = Object.keys(provider.ambientNotificationIcons);
let separator = document.getElementById("socialAmbientMenuSeparator");
for each(let name in iconNames) { for each(let name in iconNames) {
let icon = provider.ambientNotificationIcons[name]; let icon = provider.ambientNotificationIcons[name];
if (!icon.label || !icon.menuURL) if (!icon.label || !icon.menuURL)
continue; continue;
separator.hidden = false;
let menuitem = document.createElement("menuitem"); let menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", icon.label); menuitem.setAttribute("label", icon.label);
menuitem.classList.add("ambient-menuitem"); menuitem.classList.add("ambient-menuitem");
@ -639,9 +647,7 @@ var SocialMenu = {
}, false); }, false);
submenu.insertBefore(menuitem, separator); submenu.insertBefore(menuitem, separator);
} }
separator.hidden = !iconNames.length;
} }
document.getElementById("menu_socialAmbientMenu").hidden = !Social.enabled;
} }
}; };