fix(desktop): restore legacy webview tints and active tab background

This commit is contained in:
知食分子 authored and GitHub committed 2026-09-26 07:20:45 +08:00
1 parent b504b3e8a9
commit 4ad9c5f38f
11 files changed
+364 -16

No files matched your search

@@ -67,6 +67,7 @@ import LightDropdown from "@/components/ui/LightDropdown.vue";
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { Input } from "@/components/ui/input";
import { appTabActiveBackground, appTabActiveIndicator } from "@/lib/tabs/tabPresentation";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import DatabaseIcon from "@/components/icons/DatabaseIcon.vue";
@@ -166,10 +167,9 @@ function specialPageTabClass(active: boolean): string[] {
function specialPageTabStyle(active: boolean) {
if (!active) return undefined;
const activeBackground = "color-mix(in srgb, var(--foreground) 18%, var(--background))";
if (isVerticalLayout.value) return { "--app-tab-background": "var(--accent)" };
if (!isClassicLayout.value) return { "--app-tab-background": activeBackground, borderColor: "var(--ring)" };
return { "--app-tab-background": activeBackground, boxShadow: "inset 0 -2px 0 color-mix(in srgb, var(--foreground) 72%, transparent)" };
if (!isClassicLayout.value) return { "--app-tab-background": appTabActiveBackground(), borderColor: "var(--ring)" };
return { "--app-tab-background": appTabActiveBackground(), boxShadow: appTabActiveIndicator() };
}
const isVerticalLayout = computed(() => settingsStore.editorSettings.tabPlacement === "left" || settingsStore.editorSettings.tabPlacement === "right");
const isWrapLayout = computed(() => !isVerticalLayout.value && settingsStore.editorSettings.tabLayout === "wrap");
@@ -131,6 +131,19 @@ describe("EditorGroupTabBar group behavior", () => {
beforeEach(() => {
document.body.innerHTML = "";
vi.restoreAllMocks();
// Pin the engine to modern capabilities: these tests assert the designed
// styles, not the legacy WebView fallbacks (covered in styles/__tests__).
vi.stubGlobal("CSS", { supports: () => true });
vi.stubGlobal("matchMedia", (query: string) => ({
media: query,
matches: true,
addEventListener: () => {},
removeEventListener: () => {},
addListener: () => {},
removeListener: () => {},
dispatchEvent: () => false,
onchange: null,
}));
pinia = createPinia();
setActivePinia(pinia);
});
@@ -326,7 +326,10 @@
}
.app-tab-pill[data-active-tab="false"]:hover {
background-color: var(--app-tab-hover-background, color-mix(in oklch, var(--foreground) 8%, transparent));
/* The fallback must parse on WebKit without color-mix() (macOS 12 Safari
* < 16.2): a color-mix() fallback would invalidate the whole declaration
* there and uncolored tabs would get no hover feedback at all. */
background-color: var(--app-tab-hover-background, rgba(var(--dbx-foreground-rgb), 0.08));
}
.app-tab-bar:not(.vertical-tab-layout) .app-tab-pill {
@@ -1018,6 +1021,15 @@
background-color: var(--tab-group-soft);
}
/* WebKit without color-mix() (macOS 12 Safari < 16.2) drops the color-mix
* declarations above, leaving the active vertical tab unpainted; restore the
* background and border over the same tokens. The composite box-shadow stays
* out — losing it is cosmetic, and a partial shadow list is all-or-nothing. */
html.dbx-legacy-webview .vertical-tab-layout .app-tab-pill:not(.tab-group-tab)[data-active-tab="true"] {
background-color: rgba(var(--dbx-foreground-rgb), 0.16) !important;
border-color: rgba(var(--dbx-foreground-rgb), 0.32) !important;
}
.vertical-tab-layout .app-tab-scroll > * {
width: 100%;
flex: none;