mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 949365 - [Australis] Ctrl-K/Cmd-K doesn't focus the search bar. r=Gijs
This commit is contained in:
parent
c6a78ca71c
commit
227079f6d3
@ -2936,27 +2936,29 @@ const BrowserSearch = {
|
||||
|
||||
let searchBar = this.searchBar;
|
||||
let placement = CustomizableUI.getPlacementOfWidget("search-container");
|
||||
let focusSearchBar = () => {
|
||||
searchBar = this.searchBar;
|
||||
searchBar.select();
|
||||
openSearchPageIfFieldIsNotActive(searchBar);
|
||||
};
|
||||
if (placement && placement.area == CustomizableUI.AREA_PANEL) {
|
||||
PanelUI.show().then(() => {
|
||||
// The panel is not constructed until the first time it is shown.
|
||||
searchBar = this.searchBar;
|
||||
searchBar.select();
|
||||
openSearchPageIfFieldIsNotActive(searchBar);
|
||||
});
|
||||
return;
|
||||
} else if (placement.area == CustomizableUI.AREA_NAVBAR && searchBar &&
|
||||
searchBar.parentNode.classList.contains("overflowedItem")) {
|
||||
let navBar = document.getElementById(CustomizableUI.AREA_NAVBAR);
|
||||
navBar.overflowable.show().then(() => {
|
||||
// The searchBar gets moved when the overflow panel opens.
|
||||
searchBar = this.searchBar;
|
||||
searchBar.select();
|
||||
openSearchPageIfFieldIsNotActive(searchBar);
|
||||
focusSearchBar();
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (searchBar && window.fullScreen) {
|
||||
FullScreen.mouseoverToggle(true);
|
||||
if (placement.area == CustomizableUI.AREA_NAVBAR && searchBar &&
|
||||
searchBar.parentNode.classList.contains("overflowedItem")) {
|
||||
let navBar = document.getElementById(CustomizableUI.AREA_NAVBAR);
|
||||
navBar.overflowable.show().then(() => {
|
||||
focusSearchBar();
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (searchBar) {
|
||||
if (window.fullScreen)
|
||||
FullScreen.mouseoverToggle(true);
|
||||
searchBar.select();
|
||||
}
|
||||
openSearchPageIfFieldIsNotActive(searchBar);
|
||||
|
@ -85,6 +85,18 @@ let gTests = [
|
||||
ok(!navbar.hasAttribute("overflowing"), "Should not have an overflowing toolbar.");
|
||||
}
|
||||
},
|
||||
{
|
||||
desc: "Ctrl+K should focus the search bar if it is in the navbar and not overflowing.",
|
||||
run: function() {
|
||||
let searchbar = document.getElementById("searchbar");
|
||||
let placement = CustomizableUI.getPlacementOfWidget("search-container");
|
||||
is(placement.area, CustomizableUI.AREA_NAVBAR, "Should be in nav-bar");
|
||||
|
||||
sendWebSearchKeyCommand();
|
||||
logActiveElement();
|
||||
is(document.activeElement, searchbar.textbox.inputField, "The searchbar should be focused");
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
function test() {
|
||||
|
Loading…
Reference in New Issue
Block a user