Bug 808422 - add 'Focus chats' as a keyboard-only item on the social menu. r=jaws

This commit is contained in:
Mark Hammond 2012-11-27 17:58:55 +11:00
parent 2dc7eec033
commit 7e85076060
5 changed files with 18 additions and 6 deletions

View File

@ -535,6 +535,12 @@
command="Social:ToggleNotifications"
label="&social.toggleNotifications.label;"
accesskey="&social.toggleNotifications.accesskey;"/>
<menuitem id="menu_focusChatBar"
label="&social.chatBar.label;"
accesskey="&social.chatBar.accesskey;"
key="focusChatBar"
command="Social:FocusChat"
class="show-only-for-keyboard"/>
<menuseparator class="social-statusarea-separator"/>
<menuitem class="social-toggle-menuitem" command="Social:Toggle"/>
<menuitem class="social-remove-menuitem" command="Social:Remove"/>

View File

@ -116,6 +116,7 @@
<command id="Social:UnsharePage" oncommand="SocialShareButton.unsharePage();"/>
<command id="Social:ToggleSidebar" oncommand="Social.toggleSidebar();"/>
<command id="Social:ToggleNotifications" oncommand="Social.toggleNotifications();"/>
<command id="Social:FocusChat" oncommand="SocialChatBar.focus();" hidden="true" disabled="true"/>
<command id="Social:Toggle" oncommand="Social.toggle();" hidden="true"/>
<command id="Social:Remove" oncommand="SocialUI.disableWithConfirmation();"/>
</commandset>
@ -415,7 +416,7 @@
#endif
<key id="sharePage" key="&sharePageCmd.commandkey;" command="Social:SharePage" modifiers="accel,shift"/>
<key id="focusChatBar" key="&social.chatBar.commandkey;" oncommand="SocialChatBar.focus();" modifiers="accel,shift"/>
<key id="focusChatBar" key="&social.chatBar.commandkey;" command="Social:FocusChat" modifiers="accel,shift"/>
# don't use |command="Browser:Stop"|, ESC is being used to freeze animated gifs,
# even if the stop button and menuitem are disabled (see Bug 284140)

View File

@ -258,11 +258,14 @@ let SocialChatBar = {
this.chatbar.openChat(aProvider, aURL, aCallback, aMode);
},
update: function() {
if (!this.isAvailable)
let command = document.getElementById("Social:FocusChat");
if (!this.isAvailable) {
this.chatbar.removeAll();
else {
this.chatbar.hidden = document.mozFullScreen;
command.hidden = true;
} else {
this.chatbar.hidden = command.hidden = document.mozFullScreen;
}
command.setAttribute("disabled", command.hidden ? "true" : "false");
},
focus: function SocialChatBar_focus() {
this.chatbar.focus();

View File

@ -46,7 +46,7 @@ var tests = {
toolsPopup.removeEventListener("popupshown", ontoolspopupshownNoAmbient);
let socialToggleMore = document.getElementById("menu_socialAmbientMenu");
ok(socialToggleMore, "Keyboard accessible social menu should exist");
is(socialToggleMore.querySelectorAll("menuitem").length, 5, "The minimum number of menuitems is two when there are no ambient notifications.");
is(socialToggleMore.querySelectorAll("menuitem").length, 6, "The minimum number of menuitems is two when there are no ambient notifications.");
is(socialToggleMore.hidden, false, "Menu should be visible since we show some non-ambient notifications in the menu.");
toolsPopup.hidePopup();
next();
@ -104,7 +104,7 @@ var tests = {
toolsPopup.removeEventListener("popupshown", ontoolspopupshownAmbient);
let socialToggleMore = document.getElementById("menu_socialAmbientMenu");
ok(socialToggleMore, "Keyboard accessible social menu should exist");
is(socialToggleMore.querySelectorAll("menuitem").length, 8, "The number of menuitems is minimum plus three ambient notification menuitems.");
is(socialToggleMore.querySelectorAll("menuitem").length, 9, "The number of menuitems is minimum plus three ambient notification menuitems.");
is(socialToggleMore.hidden, false, "Menu is visible when ambient notifications have label & menuURL");
let menuitem = socialToggleMore.querySelector(".ambient-menuitem");
is(menuitem.getAttribute("label"), "Test Ambient 1", "Keyboard accessible ambient menuitem should have specified label");

View File

@ -659,3 +659,5 @@ toolbar button -->
<!ENTITY social.activated.undobutton.accesskey "U">
<!ENTITY social.chatBar.commandkey "c">
<!ENTITY social.chatBar.label "Focus chats">
<!ENTITY social.chatBar.accesskey "c">