bug 933989 - New tab button in tab bar always sets focus to the url bar, triggering soft keyboard r=mbrubeck

* * *
Bug 933989 - Test

--HG--
extra : rebase_source : 840d85ee3bcdec9ec4ac76dce1ae72ce7ef13012
This commit is contained in:
Rodrigo Silveira 2013-11-27 15:57:32 -08:00
parent b04c4c4053
commit 9d04c8e972
3 changed files with 32 additions and 3 deletions

View File

@ -965,6 +965,7 @@ var BrowserUI = {
case "cmd_quit":
case "cmd_close":
case "cmd_newTab":
case "cmd_newTabKey":
case "cmd_closeTab":
case "cmd_undoCloseTab":
case "cmd_actions":
@ -1056,6 +1057,9 @@ var BrowserUI = {
this._closeOrQuit();
break;
case "cmd_newTab":
this.addAndShowTab();
break;
case "cmd_newTabKey":
this.addAndShowTab();
// Make sure navbar is displayed before setting focus on url bar. Bug 907244
ContextUI.displayNavbar();

View File

@ -76,6 +76,7 @@
<!-- tabs -->
<command id="cmd_newTab" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_newTabKey" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_closeTab" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_undoCloseTab" oncommand="CommandUpdater.doCommand(this.id);"/>
#ifdef MOZ_SERVICES_SYNC
@ -152,8 +153,8 @@ Desktop browser's sync prefs.
-->
<!-- manage tabs -->
<key id="key_newTab" key="&newTab.key;" modifiers="accel" command="cmd_newTab"/>
<key id="key_newTab2" key="&newTab2.key;" modifiers="accel" command="cmd_newTab"/>
<key id="key_newTab" key="&newTab.key;" modifiers="accel" command="cmd_newTabKey"/>
<key id="key_newTab2" key="&newTab2.key;" modifiers="accel" command="cmd_newTabKey"/>
<key id="key_closeTab" key="&closeTab.key;" modifiers="accel" command="cmd_closeTab"/>
<key id="key_closeTab2" keycode="VK_F4" modifiers="accel" command="cmd_closeTab"/>
<key id="key_undoCloseTab" key="&newTab.key;" modifiers="accel,shift" command="cmd_undoCloseTab"/>

View File

@ -209,7 +209,7 @@ gTests.push({
// addTab will dismiss navbar, but lets check anyway.
ok(!ContextUI.navbarVisible, "navbar dismissed");
BrowserUI.doCommand("cmd_newTab");
BrowserUI.doCommand("cmd_newTabKey");
let newTab = Browser.selectedTab;
yield newTab.pageShowPromise;
@ -232,3 +232,27 @@ gTests.push({
Browser.closeTab(mozTab, { forceClose: true });
}
});
gTests.push({
desc: "Bug 933989 - New tab button in tab bar always sets focus to the url bar, triggering soft keyboard",
run: function () {
let mozTab = yield addTab("about:mozilla");
// addTab will dismiss navbar, but lets check anyway.
ok(!ContextUI.navbarVisible, "navbar dismissed");
BrowserUI.doCommand("cmd_newTab");
let newTab = Browser.selectedTab;
yield newTab.pageShowPromise;
yield waitForCondition(() => ContextUI.navbarVisible);
ok(ContextUI.navbarVisible, "navbar visible");
let edit = document.getElementById("urlbar-edit");
ok(!edit.focused, "Edit is not focused");
Browser.closeTab(newTab, { forceClose: true });
Browser.closeTab(mozTab, { forceClose: true });
}
});