Backed out 2 changesets (bug 1953920, bug 1953927) for causing searchModeSwitcher related failures CLOSED TREE

Backed out changeset 8b74e1a3e693 (bug 1953920)
Backed out changeset 4dfd7b14198d (bug 1953927)
This commit is contained in:
Norisz Fay
2025-03-18 01:38:16 +02:00
parent 8e23c15e1b
commit 17d578c8b5
5 changed files with 34 additions and 4 deletions

View File

@@ -145,8 +145,7 @@
hidden="true" />
<menupopup id="searchmode-switcher-popup"
class="toolbar-menupopup"
consumeoutsideclicks="false">
class="toolbar-menupopup">
<label id="searchmode-switcher-popup-description"
data-l10n-id="urlbar-searchmode-popup-description"
role="heading" />

View File

@@ -82,13 +82,19 @@ export class SearchModeSwitcher {
await this.#buildSearchModeList(this.#input.window);
this.#input.view.close({ showFocusBorder: false });
if (anchor.getAttribute("open") == "true") {
lazy.PanelMultiView.hidePopup(this.#popup);
return;
}
this.#input.view.hideTemporarily();
this.#popup.addEventListener(
"popuphidden",
() => {
anchor.removeAttribute("open");
anchor.setAttribute("aria-expanded", false);
this.#input.view.restoreVisibility();
},
{ once: true }
);

View File

@@ -505,6 +505,23 @@ export class UrlbarView {
this.visibleResults = [];
}
/**
* Hide the popup that shows the Urlbar results. The popup is still
* considered "open", this will not trigger abandonment telemetry
* but will not be shown to the user.
*/
hideTemporarily() {
this.panel.toggleAttribute("hide-temporarily", true);
}
/**
* Show the Urlbar results popup after being hidden by
* `hideTemporarily`
*/
restoreVisibility() {
this.panel.toggleAttribute("hide-temporarily", false);
}
/**
* Closes the view, cancelling the query if necessary.
*

View File

@@ -263,7 +263,11 @@ add_task(async function test_focus_on_switcher_by_tab() {
"urlbar-searchmode-switcher",
"Dedicated Search button loses the focus"
);
Assert.equal(gURLBar.view.isOpen, false, "Urlbar view panel is closed");
Assert.equal(
gURLBar.view.panel.hasAttribute("hide-temporarily"),
true,
"Urlbar view panel is closed"
);
Assert.equal(gURLBar.value, input, "Inputted value still be on urlbar");
info("Close the switcher popup by Escape");

View File

@@ -89,6 +89,10 @@
width: calc(100% - 2 * (5px + var(--urlbar-container-padding)));
/* Match urlbar-background's border. */
border-inline: 1px solid transparent;
&[hide-temporarily] {
display: none;
}
}
.urlbarView-body-inner {