mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 881937 - focus the first focusable item, r=mconley
This commit is contained in:
parent
a26590e615
commit
aecf9fe2b2
@ -114,7 +114,7 @@
|
|||||||
<command id="Social:FocusChat" oncommand="SocialChatBar.focus();" hidden="true" disabled="true"/>
|
<command id="Social:FocusChat" oncommand="SocialChatBar.focus();" hidden="true" disabled="true"/>
|
||||||
<command id="Social:Toggle" oncommand="Social.toggle();" hidden="true"/>
|
<command id="Social:Toggle" oncommand="Social.toggle();" hidden="true"/>
|
||||||
<command id="Social:Addons" oncommand="BrowserOpenAddonsMgr('addons://list/service');"/>
|
<command id="Social:Addons" oncommand="BrowserOpenAddonsMgr('addons://list/service');"/>
|
||||||
<command id="MenuPanel:Toggle" oncommand="PanelUI.toggle();"/>
|
<command id="MenuPanel:Toggle" oncommand="PanelUI.toggle(event);"/>
|
||||||
</commandset>
|
</commandset>
|
||||||
|
|
||||||
<commandset id="placesCommands">
|
<commandset id="placesCommands">
|
||||||
|
@ -84,10 +84,21 @@ const PanelUI = {
|
|||||||
updateEditUIVisibility();
|
updateEditUIVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
let anchor = aEvent ? aEvent.target : this.menuButton;
|
let anchor;
|
||||||
|
if (aEvent.type == "command") {
|
||||||
|
anchor = this.menuButton;
|
||||||
|
} else {
|
||||||
|
anchor = aEvent.target;
|
||||||
|
}
|
||||||
let iconAnchor =
|
let iconAnchor =
|
||||||
document.getAnonymousElementByAttribute(anchor, "class",
|
document.getAnonymousElementByAttribute(anchor, "class",
|
||||||
"toolbarbutton-icon");
|
"toolbarbutton-icon");
|
||||||
|
|
||||||
|
// Only focus the panel if it's opened using the keyboard, so that
|
||||||
|
// cut/copy/paste buttons will work for mouse users.
|
||||||
|
let keyboardOpened = aEvent.sourceEvent &&
|
||||||
|
aEvent.sourceEvent.target.localName == "key";
|
||||||
|
this.panel.setAttribute("noautofocus", !keyboardOpened);
|
||||||
this.panel.openPopup(iconAnchor || anchor, "bottomcenter topright");
|
this.panel.openPopup(iconAnchor || anchor, "bottomcenter topright");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user