diff --git a/prefs/firefox/browser.yaml b/prefs/firefox/browser.yaml index beea8da27..43805e5bb 100644 --- a/prefs/firefox/browser.yaml +++ b/prefs/firefox/browser.yaml @@ -72,3 +72,6 @@ - name: browser.tabs.notes.enabled value: false + +- name: browser.tabs.dragDrop.moveOverThresholdPercent + value: 50 # Percentage of tab height to trigger move over on drag-and-drop diff --git a/prefs/zen/zen.yaml b/prefs/zen/zen.yaml index 4dbcbd18d..36ab42a94 100644 --- a/prefs/zen/zen.yaml +++ b/prefs/zen/zen.yaml @@ -20,6 +20,9 @@ - name: zen.tabs.close-window-with-empty value: true +- name: zen.tabs.select-recently-used-on-close + value: true + - name: zen.tabs.use-legacy-drag-and-drop value: false diff --git a/src/zen/common/styles/zen-buttons.css b/src/zen/common/styles/zen-buttons.css index 6f8a7bdf7..098f78f12 100644 --- a/src/zen/common/styles/zen-buttons.css +++ b/src/zen/common/styles/zen-buttons.css @@ -31,6 +31,9 @@ dialog::part(dialog-button) { &:is([dlgtype="accept"], [dlgtype="cancel"]) { padding-inline-end: 3.7em; + @media (-moz-platform: windows) { + padding-inline-end: 4em; + } &::after { border-radius: 4px; @@ -48,7 +51,7 @@ dialog::part(dialog-button) { &[dlgtype="accept"]::after { content: "⏎"; background: rgba(255, 255, 255, 0.1); - outline: 2px solid color-mix(in srgb, currentColor 30%, transparent); + outline: 2px solid color-mix(in srgb, currentColor 20%, transparent); outline-offset: -2px; } diff --git a/src/zen/common/styles/zen-omnibox.css b/src/zen/common/styles/zen-omnibox.css index fa5839ded..2b9729762 100644 --- a/src/zen/common/styles/zen-omnibox.css +++ b/src/zen/common/styles/zen-omnibox.css @@ -16,11 +16,12 @@ } } -#urlbar { +.urlbar { --urlbarView-separator-color: light-dark(hsl(0, 0%, 89%), hsl(0, 0%, 20%)); --urlbarView-hover-background: var(--toolbarbutton-hover-background); --urlbarView-highlight-background: var(--toolbarbutton-hover-background); border-radius: calc(var(--toolbarbutton-border-radius) - 2px); + height: var(--urlbar-height); --urlbarView-results-padding: 8px !important; --urlbar-container-height: 48px !important; diff --git a/src/zen/tests/tabs/browser.toml b/src/zen/tests/tabs/browser.toml index eee3f05d4..f383ece5d 100644 --- a/src/zen/tests/tabs/browser.toml +++ b/src/zen/tests/tabs/browser.toml @@ -8,6 +8,7 @@ support-files = [ ] ["browser_tabs_empty_checks.js"] +["browser_tabs_close_recently.js"] ["browser_tabs_fetch_checks.js"] ["browser_tabs_cycle_by_attribute.js"] ["browser_drag_drop_vertical.js"] diff --git a/src/zen/tests/tabs/browser_drag_drop_vertical.js b/src/zen/tests/tabs/browser_drag_drop_vertical.js index 0d0c513e8..fcaa72f4c 100644 --- a/src/zen/tests/tabs/browser_drag_drop_vertical.js +++ b/src/zen/tests/tabs/browser_drag_drop_vertical.js @@ -52,7 +52,7 @@ async function dropAfter(itemToDrag, itemToDropAfter, win) { const midline = rect.left + 0.5 * rect.width; // Point where bottom edge of `itemToDrag` overlaps `itemToDropAfter` enough // for `itemToDrag` to come after. - const afterPoint = Math.ceil(rect.top + threshold * rect.height); + const afterPoint = Math.ceil(rect.top + (threshold + 0.5) * rect.height); const dragTo = afterPoint - sourceRect.height / 2; await drop(itemToDrag, itemToDropAfter, midline, dragTo, win); } @@ -71,7 +71,7 @@ async function dropBefore(itemToDrag, itemToDropBefore, win) { const midline = rect.left + 0.5 * rect.width; // Point where top edge of `itemToDrag` overlaps `itemToDropBefore` enough // for `itemToDrag` to come before. - const beforePoint = Math.floor(rect.top + (1 - threshold) * rect.height); + const beforePoint = Math.floor(rect.top + (1 - threshold - 0.5) * rect.height); const dragTo = beforePoint + sourceRect.height / 2; await drop(itemToDrag, itemToDropBefore, midline, dragTo, win); } diff --git a/src/zen/tests/tabs/browser_tabs_close_recently.js b/src/zen/tests/tabs/browser_tabs_close_recently.js new file mode 100644 index 000000000..e06387b91 --- /dev/null +++ b/src/zen/tests/tabs/browser_tabs_close_recently.js @@ -0,0 +1,80 @@ +/* Any copyright is dedicated to the Public Domain. + https://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const URL1 = "data:text/plain,tab1"; +const URL2 = "data:text/plain,tab2"; +const URL3 = "data:text/plain,tab3"; + +add_task(async function test_blurToRecentlyClosedTab() { + const [tab1, tab2, tab3] = [ + BrowserTestUtils.addTab(gBrowser, URL1), + BrowserTestUtils.addTab(gBrowser, URL2), + BrowserTestUtils.addTab(gBrowser, URL3), + ]; + + gBrowser.selectedTab = tab2; + gBrowser.selectedTab = tab3; + gBrowser.selectedTab = tab1; + + gBrowser.selectedTab = tab2; + gBrowser.removeTab(tab2); + + Assert.equal( + gBrowser.selectedTab, + tab1, + "After closing the most recently used tab, the selection moves to the last used tab" + ); + + gBrowser.selectedTab = tab3; + gBrowser.removeTab(tab3); + + Assert.equal( + gBrowser.selectedTab, + tab1, + "After closing the most recently used tab, the selection moves to the last used tab" + ); + + gBrowser.removeTab(tab1); +}); + +add_task(async function test_closeToLastTab() { + await SpecialPowers.pushPrefEnv({ + set: [ + ["zen.tabs.select-recently-used-on-close", false], + ["zen.view.show-newtab-button-top", false], + ], + }); + + const [tab1, tab2, tab3] = [ + BrowserTestUtils.addTab(gBrowser, URL1), + BrowserTestUtils.addTab(gBrowser, URL2), + BrowserTestUtils.addTab(gBrowser, URL3), + ]; + + gBrowser.selectedTab = tab2; + gBrowser.selectedTab = tab3; + gBrowser.selectedTab = tab1; + + gBrowser.selectedTab = tab2; + gBrowser.removeTab(tab2); + + Assert.equal( + gBrowser.selectedTab, + tab3, + "After closing the current tab, the selection moves to the next tab in order" + ); + + gBrowser.selectedTab = tab1; + gBrowser.removeTab(tab1); + + Assert.equal( + gBrowser.selectedTab, + tab3, + "After closing the current tab, the selection moves to the next tab in order" + ); + + gBrowser.removeTab(tab3); + await SpecialPowers.popPrefEnv(); +}); diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index c860faf40..983c92d5a 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -2819,9 +2819,8 @@ class nsZenWorkspaces { const tabWorkspaceId = aTab.getAttribute("zen-workspace-id"); const containerId = aTab.getAttribute("usercontextid") ?? "0"; // Return all tabs that are not on the same workspace - return this.allStoredTabs.filter( + return gBrowser.tabs.filter( (tab) => - tab.getAttribute("zen-workspace-id") !== tabWorkspaceId && !this._shouldShowTab(tab, tabWorkspaceId, containerId, this._workspaceCache) && !tab.hasAttribute("zen-empty-tab") );