Bug 249735 - Let F6 focus the location bar instead of the first focusable element. r=enn

This commit is contained in:
Dão Gottwald 2011-12-24 05:12:11 +01:00
parent 80f7f0700f
commit ded8113654
2 changed files with 9 additions and 0 deletions

View File

@ -116,6 +116,7 @@
<command id="Browser:PrevTab" oncommand="gBrowser.tabContainer.advanceSelectedTab(-1, true);"/>
<command id="Browser:ShowAllTabs" oncommand="allTabs.open();"/>
<command id="Browser:ToggleTabView" oncommand="TabView.toggle();"/>
<command id="Browser:FocusNextFrame" oncommand="focusNextFrame(event);"/>
<command id="cmd_fullZoomReduce" oncommand="FullZoom.reduce()"/>
<command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
<command id="cmd_fullZoomReset" oncommand="FullZoom.reset()"/>
@ -304,6 +305,7 @@
#ifndef XP_MACOSX
<key id="showAllHistoryKb" key="&showAllHistoryCmd.commandkey;" command="Browser:ShowAllHistory" modifiers="accel,shift"/>
<key keycode="VK_F5" command="Browser:ReloadSkipCache" modifiers="accel"/>
<key keycode="VK_F6" command="Browser:FocusNextFrame"/>
<key id="key_fullScreen" keycode="VK_F11" command="View:FullScreen"/>
#else
<key id="key_fullScreen" key="&fullScreenCmd.macCommandKey;" command="View:FullScreen" modifiers="accel,shift"/>

View File

@ -9019,3 +9019,10 @@ XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () {
#endif
});
function focusNextFrame(event) {
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
let dir = event.shiftKey ? fm.MOVEFOCUS_BACKWARDDOC : fm.MOVEFOCUS_FORWARDDOC;
let element = fm.moveFocus(window, null, dir, fm.FLAG_BYKEY);
if (element.ownerDocument == document)
focusAndSelectUrlBar();
}