feat: Improved urlbar actions selection, b=no-bug, c=common, kbs

This commit is contained in:
mr. m
2025-09-16 00:17:34 +02:00
parent d4139f0312
commit 7a0cda82ff
6 changed files with 26 additions and 27 deletions

View File

@@ -876,7 +876,7 @@ var gZenCKSSettings = {
const action = shortcut.getAction();
const l10nID = shortcut.getL10NID();
const group = shortcut.getGroup();
const keyInString = shortcut.toUserString();
const keyInString = shortcut.toDisplayString();
const labelValue = zenMissingKeyboardShortcutL10n[keyID] ?? l10nID;
@@ -1069,7 +1069,7 @@ var gZenCKSSettings = {
this._hasSafed = false;
input.classList.remove(`${ZEN_CKS_INPUT_FIELD_CLASS}-invalid`);
input.classList.remove(`${ZEN_CKS_INPUT_FIELD_CLASS}-not-set`);
input.value = modifiers.toUserString() + shortcut;
input.value = modifiers.toDisplayString() + shortcut;
this._latestValidKey = shortcut;
},
};

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarView.sys.mjs b/browser/components/urlbar/UrlbarView.sys.mjs
index fdbab8806fd320f4aacec46a42c8ef953580d00c..c7fd607cc1e3ec4db2d5300a420c9de5f5ac6c0d 100644
index fdbab8806fd320f4aacec46a42c8ef953580d00c..2a6f22178aa42e8f1a7d0b58e02db85f712b01dc 100644
--- a/browser/components/urlbar/UrlbarView.sys.mjs
+++ b/browser/components/urlbar/UrlbarView.sys.mjs
@@ -613,7 +613,7 @@ export class UrlbarView {
@@ -11,15 +11,19 @@ index fdbab8806fd320f4aacec46a42c8ef953580d00c..c7fd607cc1e3ec4db2d5300a420c9de5
// Try to reuse the cached top-sites context. If it's not cached, then
// there will be a gap of time between when the input is focused and
// when the view opens that can be perceived as flicker.
@@ -824,6 +824,22 @@ export class UrlbarView {
@@ -824,6 +824,26 @@ export class UrlbarView {
// still associated with the first result.
this.input.setResultForCurrentValue(firstResult);
}
+ if (queryContext.results[0].payload.zenAction) {
+ this.#selectElement(this.getFirstSelectableElement(), {
+ updateInput: false,
+ setAccessibleFocus:
+ this.controller._userSelectionBehavior == "arrow",
+ this.window.setTimeout(() => {
+ this.window.setTimeout(() => {
+ this.#selectElement(this.getFirstSelectableElement(), {
+ updateInput: false,
+ setAccessibleFocus:
+ this.controller._userSelectionBehavior == "arrow",
+ });
+ });
+ });
+ }
+ this.window.setTimeout(() => {
@@ -30,11 +34,11 @@ index fdbab8806fd320f4aacec46a42c8ef953580d00c..c7fd607cc1e3ec4db2d5300a420c9de5
+ this.controller._userSelectionBehavior == "arrow",
+ });
+ }
+ }, 10);
+ }, 220);
}
// Announce tab-to-search results to screen readers as the user types.
@@ -2706,6 +2722,8 @@ export class UrlbarView {
@@ -2706,6 +2726,8 @@ export class UrlbarView {
if (row?.hasAttribute("row-selectable")) {
row?.toggleAttribute("selected", true);
}
@@ -43,7 +47,7 @@ index fdbab8806fd320f4aacec46a42c8ef953580d00c..c7fd607cc1e3ec4db2d5300a420c9de5
if (element != row) {
row?.toggleAttribute("descendant-selected", true);
}
@@ -3189,7 +3207,7 @@ export class UrlbarView {
@@ -3189,7 +3211,7 @@ export class UrlbarView {
}
#enableOrDisableRowWrap() {