mirror of
https://github.com/zen-browser/desktop.git
synced 2026-01-30 08:34:37 +00:00
feat: Improved urlbar actions selection, b=no-bug, c=common, kbs
This commit is contained in:
@@ -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;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
& .urlbar-background {
|
||||
--zen-urlbar-background-base: light-dark(
|
||||
white,
|
||||
color-mix(in srgb, hsl(0, 0%, 11%), var(--zen-colors-primary) 40%)
|
||||
color-mix(in srgb, hsl(0, 0%, 5%), var(--zen-colors-primary) 20%)
|
||||
);
|
||||
@media -moz-pref('zen.theme.acrylic-elements') {
|
||||
--zen-urlbar-background-transparent: color-mix(
|
||||
@@ -235,7 +235,7 @@
|
||||
|
||||
#urlbar[open]
|
||||
:is(#tracking-protection-icon-container, .urlbar-page-action, .identity-box-button):not(
|
||||
[hidden='true']
|
||||
[hidden]
|
||||
):not(#identity-permission-box),
|
||||
#urlbar:hover #identity-icon-box {
|
||||
opacity: 1 !important;
|
||||
@@ -305,17 +305,11 @@
|
||||
height: calc(var(--urlbar-min-height) - 4 * var(--urlbar-container-padding)) !important;
|
||||
}
|
||||
|
||||
button.popup-notification-dropmarker {
|
||||
.popup-notification-dropmarker {
|
||||
border-top-left-radius: 0 !important;
|
||||
border-bottom-left-radius: 0 !important;
|
||||
}
|
||||
|
||||
.panel-footer:has(button.popup-notification-dropmarker:not([hidden='true']))
|
||||
button.popup-notification-secondary-button {
|
||||
border-top-right-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
}
|
||||
|
||||
.searchbar-engine-one-off-item {
|
||||
max-width: 28px;
|
||||
min-width: 28px !important;
|
||||
@@ -655,7 +649,8 @@ button.popup-notification-dropmarker {
|
||||
max-height: 262px;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: none;
|
||||
margin-block: var(--urlbarView-results-padding);
|
||||
margin-block-start: var(--urlbarView-results-padding);
|
||||
margin-block-end: calc(var(--urlbarView-results-padding) + 2px);
|
||||
padding-block: 0 !important;
|
||||
|
||||
& .action-contextualidentity {
|
||||
|
||||
@@ -192,7 +192,7 @@ class nsKeyShortcutModifiers {
|
||||
return new nsKeyShortcutModifiers(ctrl, alt, shift, meta, accel);
|
||||
}
|
||||
|
||||
toUserString() {
|
||||
toDisplayString() {
|
||||
let str = '';
|
||||
const separation = AppConstants.platform == 'macosx' ? ' ' : '+';
|
||||
if (this.#control && !this.#accel) {
|
||||
@@ -543,8 +543,8 @@ class KeyShortcut {
|
||||
};
|
||||
}
|
||||
|
||||
toUserString() {
|
||||
let str = this.#modifiers.toUserString();
|
||||
toDisplayString() {
|
||||
let str = this.#modifiers.toDisplayString();
|
||||
|
||||
if (this.#key) {
|
||||
str += this.#key.toUpperCase();
|
||||
@@ -1087,7 +1087,7 @@ class nsZenKeyboardShortcutsVersioner {
|
||||
'+',
|
||||
'',
|
||||
ZEN_SPLIT_VIEW_SHORTCUTS_GROUP,
|
||||
nsKeyShortcutModifiers.fromObject({ accel: true, alt: true }),
|
||||
nsKeyShortcutModifiers.fromObject({ accel: true, shift: true }),
|
||||
'cmd_zenNewEmptySplit',
|
||||
'zen-new-empty-split-view-shortcut'
|
||||
)
|
||||
@@ -1382,7 +1382,7 @@ var gZenKeyboardShortcutsManager = {
|
||||
}
|
||||
const shortcut = this.getShortcutFromCommand(command);
|
||||
if (shortcut) {
|
||||
return shortcut.toUserString();
|
||||
return shortcut.toDisplayString();
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
@@ -234,6 +234,7 @@ export class ZenUrlbarProviderGlobalActions extends UrlbarProvider {
|
||||
shortcutContent: ownerGlobal.gZenKeyboardShortcutsManager.getShortcutDisplayFromCommand(
|
||||
action.command
|
||||
),
|
||||
keywords: action.label.split(' '),
|
||||
...action.extraPayload,
|
||||
});
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ const globalActionsTemplate = [
|
||||
label: 'Open Theme Picker',
|
||||
command: 'cmd_zenOpenZenThemePicker',
|
||||
icon: 'chrome://browser/skin/zen-icons/edit-theme.svg',
|
||||
suggestedIndex: 4,
|
||||
},
|
||||
{
|
||||
label: 'New Split View',
|
||||
|
||||
Reference in New Issue
Block a user