Bug 1928132: Implement dynamic Unified Search Button mode r=desktop-theme-reviewers,daleharvey,dao,tabbrowser-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D228954
This commit is contained in:
Daisuke Akatsuka
2024-11-29 11:18:02 +00:00
parent c48a63d430
commit c738c0eb32
15 changed files with 347 additions and 60 deletions

View File

@@ -3915,6 +3915,24 @@ export class UrlbarInput {
this.logger.debug("Focus Event");
if (!this._hideFocus) {
this.toggleAttribute("focused", true);
// Prevent from showing USB until finishing user's operation if the focus
// is moved by mouse since user might select the urlbar value.
if (
lazy.UrlbarPrefs.get("usb.dynamic") &&
Services.focus.getLastFocusMethod(this.window) ==
Services.focus.FLAG_BYMOUSE &&
this.getAttribute("pageproxystate") == "valid"
) {
this.toggleAttribute("usb-focus-processing", true);
this.window.addEventListener(
"mouseup",
() => {
this.removeAttribute("usb-focus-processing");
},
{ once: true }
);
}
}
// If the value was trimmed, check whether we should untrim it.