diff --git a/browser/components/search/content/search.xml b/browser/components/search/content/search.xml index 3be48078ff1..8ee47044a83 100644 --- a/browser/components/search/content/search.xml +++ b/browser/components/search/content/search.xml @@ -1143,6 +1143,10 @@ let isOneOffSelected = this.selectedButton && this.selectedButton.classList.contains("searchbar-engine-one-off-item"); + // Typing de-selects the settings or opensearch buttons at the bottom + // of the search panel, as typing shows the user intends to search. + if (this.selectedButton && !isOneOffSelected) + this.selectedButton = null; if (textbox.value) { self.removeAttribute("showonlysettings"); groupText = headerSearchText.previousSibling.value + diff --git a/browser/components/search/test/browser_searchbar_keyboard_navigation.js b/browser/components/search/test/browser_searchbar_keyboard_navigation.js index c7d8726c7f8..86cc76c567e 100644 --- a/browser/components/search/test/browser_searchbar_keyboard_navigation.js +++ b/browser/components/search/test/browser_searchbar_keyboard_navigation.js @@ -152,6 +152,23 @@ add_task(function* test_arrows() { "the textfield value should be back to initial value"); }); +add_task(function* test_typing_clears_button_selection() { + is(Services.focus.focusedElement, textbox.inputField, + "the search bar should be focused"); // from the previous test. + ok(!textbox.selectedButton, "no button should be selected"); + + EventUtils.synthesizeKey("VK_UP", {}); + is(textbox.selectedButton.getAttribute("anonid"), "search-settings", + "the settings item should be selected"); + + // Type a character. + EventUtils.synthesizeKey("a", {}); + ok(!textbox.selectedButton, "the settings item should be de-selected"); + + // Remove the character. + EventUtils.synthesizeKey("VK_BACK_SPACE", {}); +}); + add_task(function* test_tab() { is(Services.focus.focusedElement, textbox.inputField, "the search bar should be focused"); // from the previous test.