Bug 892384 - When switching to a tab with an open find bar, focus it. r=dao

--HG--
extra : rebase_source : b55d5a749c8349552fdcebd531da893bebe18007
This commit is contained in:
Adam Dane [:hobophobe] 2013-07-11 18:42:34 -05:00
parent 6b681d0ed7
commit d830d57573
2 changed files with 7 additions and 4 deletions

View File

@ -1105,11 +1105,11 @@
}
}
// If the find bar is focused, keep it focused.
if (gFindBarInitialized &&
!gFindBar.hidden &&
gFindBar.getElement("findbar-textbox").getAttribute("focused") == "true")
// If the find bar is open, focus it.
if (gFindBarInitialized && !gFindBar.hidden) {
gFindBar._findField.focus();
break;
}
// Otherwise, focus the content area.
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);

View File

@ -69,6 +69,9 @@ function continueTests() {
ok(gFindBar.hidden, "First tab doesn't show find bar!");
gBrowser.selectedTab = tabs[1];
ok(!gFindBar.hidden, "Second tab shows find bar!");
// Test for bug 892384
is(gFindBar._findField.getAttribute("focused"), "true",
"Open findbar refocused on tab change!");
gBrowser.selectedTab = tabs[0];
ok(gFindBar.hidden, "First tab doesn't show find bar!");