Enhance URL bar behavior by adjusting primary selection suppression and refining CSS styles for compact mode

This commit is contained in:
mr. M
2025-02-07 22:23:06 +01:00
parent 64cadfe37a
commit 527b8a39f8
2 changed files with 31 additions and 17 deletions

View File

@@ -241,14 +241,16 @@
right 0.3s var(--zen-compact-mode-func); right 0.3s var(--zen-compact-mode-func);
opacity: 1; opacity: 1;
left: -1px; &:not([supress-primary-adjustment='true']) {
:root[zen-right-side='true'] & { left: -1px;
right: -1px; :root[zen-right-side='true'] & {
left: auto; right: -1px;
} left: auto;
}
& #urlbar[open][zen-floating-urlbar='true'] { & #urlbar[open][zen-floating-urlbar='true'] {
--zen-urlbar-offset: 0px; --zen-urlbar-offset: 0px;
}
} }
} }
} }

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a726c67e873 100644 index 50968dc04b527438acf30151f0c2e92f8b45097c..f3539ff3a74474f2833800ae140b0384b21a7fb0 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs --- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs +++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -67,6 +67,13 @@ XPCOMUtils.defineLazyPreferenceGetter( @@ -67,6 +67,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
@@ -16,7 +16,19 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
const DEFAULT_FORM_HISTORY_NAME = "searchbar-history"; const DEFAULT_FORM_HISTORY_NAME = "searchbar-history";
const SEARCH_BUTTON_CLASS = "urlbar-search-button"; const SEARCH_BUTTON_CLASS = "urlbar-search-button";
@@ -424,6 +431,10 @@ export class UrlbarInput { @@ -348,7 +355,11 @@ export class UrlbarInput {
// See _on_select(). HTMLInputElement.select() dispatches a "select"
// event but does not set the primary selection.
this._suppressPrimaryAdjustment = true;
+ this.document.getElementById("navigator-toolbox").setAttribute("supress-primary-adjustment", true);
this.inputField.select();
+ this.document.ownerGlobal.setTimeout(() => {
+ this.document.getElementById("navigator-toolbox").removeAttribute("supress-primary-adjustment");
+ }, 0);
this._suppressPrimaryAdjustment = false;
}
@@ -424,6 +435,10 @@ export class UrlbarInput {
hideSearchTerms = false, hideSearchTerms = false,
isSameDocument = false isSameDocument = false
) { ) {
@@ -27,7 +39,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
// We only need to update the searchModeUI on tab switch conditionally // We only need to update the searchModeUI on tab switch conditionally
// as we only persist searchMode with ScotchBonnet enabled. // as we only persist searchMode with ScotchBonnet enabled.
if ( if (
@@ -1087,7 +1098,11 @@ export class UrlbarInput { @@ -1087,7 +1102,11 @@ export class UrlbarInput {
} }
if (!result.payload.providesSearchMode) { if (!result.payload.providesSearchMode) {
@@ -40,7 +52,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
} }
this.controller.recordSelectedResult(event, result); this.controller.recordSelectedResult(event, result);
@@ -2144,6 +2159,11 @@ export class UrlbarInput { @@ -2144,6 +2163,11 @@ export class UrlbarInput {
this.setAttribute("breakout-extend", "true"); this.setAttribute("breakout-extend", "true");
@@ -52,7 +64,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
// Enable the animation only after the first extend call to ensure it // Enable the animation only after the first extend call to ensure it
// doesn't run when opening a new window. // doesn't run when opening a new window.
if (!this.hasAttribute("breakout-extend-animate")) { if (!this.hasAttribute("breakout-extend-animate")) {
@@ -2163,6 +2183,11 @@ export class UrlbarInput { @@ -2163,6 +2187,11 @@ export class UrlbarInput {
return; return;
} }
@@ -64,7 +76,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
this.removeAttribute("breakout-extend"); this.removeAttribute("breakout-extend");
this.#updateTextboxPosition(); this.#updateTextboxPosition();
} }
@@ -3305,7 +3330,7 @@ export class UrlbarInput { @@ -3305,7 +3334,7 @@ export class UrlbarInput {
} else { } else {
where = lazy.BrowserUtils.whereToOpenLink(event, false, false); where = lazy.BrowserUtils.whereToOpenLink(event, false, false);
} }
@@ -73,7 +85,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
if (where == "current") { if (where == "current") {
where = "tab"; where = "tab";
} else if (where == "tab") { } else if (where == "tab") {
@@ -3859,6 +3884,11 @@ export class UrlbarInput { @@ -3859,6 +3888,11 @@ export class UrlbarInput {
} }
_on_click(event) { _on_click(event) {
@@ -85,7 +97,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
if ( if (
event.target == this.inputField || event.target == this.inputField ||
event.target == this._inputContainer || event.target == this._inputContainer ||
@@ -3930,7 +3960,7 @@ export class UrlbarInput { @@ -3930,7 +3964,7 @@ export class UrlbarInput {
} }
} }
@@ -94,7 +106,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
this.view.autoOpen({ event }); this.view.autoOpen({ event });
} else { } else {
if (this._untrimOnFocusAfterKeydown) { if (this._untrimOnFocusAfterKeydown) {
@@ -3970,9 +4000,12 @@ export class UrlbarInput { @@ -3970,9 +4004,12 @@ export class UrlbarInput {
} }
_on_mousedown(event) { _on_mousedown(event) {
@@ -108,7 +120,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8e8e9c06613c5d5f33333fd9e128a72
if ( if (
event.target != this.inputField && event.target != this.inputField &&
@@ -3982,8 +4015,8 @@ export class UrlbarInput { @@ -3982,8 +4019,8 @@ export class UrlbarInput {
break; break;
} }