Bug 463227 - in the All Tabs panel, TAB key should move focus to the preview. r=sdwilsh

This commit is contained in:
Dão Gottwald 2008-11-06 18:33:22 +01:00
parent c39e172979
commit 0eebc5cafa
2 changed files with 47 additions and 0 deletions

View File

@ -98,6 +98,10 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
}
/* Tab Previews */
#ctrlTab-panel {
-moz-user-focus: normal;
}
.ctrlTab-thumbnail {
-moz-binding: url("chrome://browser/content/browser-tabPreviews.xml#ctrlTab-thumbnail");
}

View File

@ -1,4 +1,6 @@
function test() {
waitForExplicitFinish();
gBrowser.addTab();
gBrowser.addTab();
gBrowser.addTab();
@ -69,6 +71,47 @@ function test() {
"Ctrl+Tab doesn't change focus if one tab is open");
}
gBrowser.addTab();
gBrowser.addTab();
gBrowser.addTab();
assertTabs(4);
selectTabs([0, 1, 2, 3]);
pressCtrlTab();
ctrlTab.panel.addEventListener("popupshown", stickyTests, false);
function stickyTests() {
ctrlTab.panel.removeEventListener("popupshown", stickyTests, false);
EventUtils.synthesizeKey("f", { ctrlKey: true });
is(document.activeElement, ctrlTab.searchField.inputField,
"Ctrl+Tab -> Ctrl+F focuses the panel's search field");
releaseCtrl();
ok(isOpen(),
"panel is sticky after focusing the search field and releasing the Ctrl key");
// blur the search field
EventUtils.synthesizeKey("VK_TAB", {});
isnot(document.activeElement, ctrlTab.searchField.inputField,
"Tab key blurs the panel's search field");
// advance selection and close panel
EventUtils.synthesizeKey("VK_TAB", {});
EventUtils.synthesizeKey("VK_RETURN", {});
ok(!isOpen(),
"Enter key closes the panel");
is(gBrowser.tabContainer.selectedIndex, 1,
"Tab key advances the selection while the panel is sticky");
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
assertTabs(1);
finish();
}
/* private utility functions */
function pressCtrlTab(aShiftKey)