Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(tabs): use one group-colored accent for grouped tabs (#13196)

zipge51cf188a674
diff --git a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts
index a392783512..42553922de 100644
--- a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts
+++ b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.groups.spec.ts
@@ -222,7 +222,7 @@ describe("EditorGroupTabBar group behavior", () => {
}
});
- it("marks the active horizontal grouped tab with a primary edge accent", async () => {
+ it("marks the active horizontal grouped tab with a full-width group-colored underline", async () => {
const store = useQueryStore();
const settings = useSettingsStore();
const connectionStore = useConnectionStore();
@@ -239,35 +239,41 @@ describe("EditorGroupTabBar group behavior", () => {
try {
await settle();
- // Exactly one pill carries the active state; the CSS accent keys off it.
+ // Exactly one pill carries the active state.
const activeTabs = host.querySelectorAll('.tab-group-tab[data-active-tab="true"]');
expect(activeTabs).toHaveLength(1);
expect(activeTabs[0]!.getAttribute("data-tab-id")).toBe(activeTabId);
- // The accent is a ::before pseudo-element, so assert it on the parsed
- // stylesheet rather than a computed style: it must paint the active
- // grouped tab with the primary accent, not the group color, so it
- // stays findable among several groups (issue #12485).
- const selectors: string[] = [];
- const heights = new Set<string>();
+
+ // The old primary ::before top accent was removed; the active grouped tab
+ // is marked by a single full-width underline on its bottom edge instead.
+ const beforeSelectors: string[] = [];
for (const sheet of document.styleSheets) {
for (const rule of sheet.cssRules) {
const styleRule = rule as CSSStyleRule;
if (styleRule.selectorText?.includes(".tab-group-tab") && styleRule.selectorText.includes('[data-active-tab="true"]') && styleRule.selectorText.endsWith("::before")) {
- selectors.push(styleRule.selectorText);
- // Geometry survives happy-dom's parser; var() paints do not.
- heights.add(styleRule.style.getPropertyValue("height"));
+ beforeSelectors.push(styleRule.selectorText);
}
}
}
- expect(selectors.length).toBeGreaterThan(0);
- expect([...heights]).toContain("3px");
- // The paint itself: the rule block must use the primary accent token so
- // the active tab reads as "the chosen one", distinct from every group's
- // own colored rail.
- const ruleStart = sharedStyles.indexOf('.tab-group-tab[data-active-tab="true"]::before');
- expect(ruleStart).toBeGreaterThan(-1);
- const ruleBlock = sharedStyles.slice(ruleStart, sharedStyles.indexOf("}", ruleStart) + 1);
- expect(ruleBlock).toContain("--app-tab-active-accent");
+ expect(beforeSelectors).toHaveLength(0);
+
+ // Geometry and paint: the underline spans the pill (no inline inset) and
+ // uses the group color, so it is not confused with the classic dark
+ // selected-state bar injected inline by tabColorStyle.
+ const underlineStart = sharedStyles.indexOf('.tab-group-tab[data-active-tab="true"]::after');
+ expect(underlineStart).toBeGreaterThan(-1);
+ const underlineBlock = sharedStyles.slice(underlineStart, sharedStyles.indexOf("}", underlineStart) + 1);
+ expect(underlineBlock).toContain("var(--tab-group-color)");
+ expect(underlineBlock).toContain("left: 0");
+ expect(underlineBlock).toContain("right: 0");
+
+ // Group headers keep their color on the marker/underline instead of the
+ // label itself, which previously used the same group color as the tinted
+ // header background and was hard to read.
+ const headerStart = sharedStyles.lastIndexOf(".app-tab-bar:not(.vertical-tab-layout) .tab-group-header {");
+ expect(headerStart).toBeGreaterThan(-1);
+ const headerBlock = sharedStyles.slice(headerStart, sharedStyles.indexOf("}", headerStart) + 1);
+ expect(headerBlock).toContain("color: var(--foreground)");
} finally {
app.unmount();
host.remove();
diff --git a/apps/desktop/src/components/layout/appTabBar.css b/apps/desktop/src/components/layout/appTabBar.css
index 8f20e7120d..75f824749b 100644
--- a/apps/desktop/src/components/layout/appTabBar.css
+++ b/apps/desktop/src/components/layout/appTabBar.css
@@ -811,39 +811,6 @@
opacity: 0.82;
}
-/* The group rail sits above the classic active inset shadow. Reuse the same
- * rail segment as the active indicator so a colored group cannot hide it. */
-.app-tab-bar:not(.vertical-tab-layout):not(:has(.wrap-mode)) .tab-group-tab[data-active-tab="true"]::after,
-.app-tab-bar:not(.vertical-tab-layout):has(.wrap-mode) .tab-group-entry:has(.tab-group-tab[data-active-tab="true"])::after {
- z-index: 2;
- background: color-mix(in srgb, var(--foreground) 72%, transparent);
- opacity: 1;
-}
-
-/* With several groups in view, the neutral rail segment above is not enough
- * to spot the active tab at a glance (issue #12485): every tab already owns a
- * colored group rail, so the bottom edge cannot carry a unique signal. Mark
- * the active grouped tab with a primary-colored edge accent on the opposite
- * edge instead — the same vocabulary as the vertical tab's inset --ring edge.
- * The var fallback keeps legacy WebViews (no color-mix()) painted. */
-.app-tab-bar:not(.vertical-tab-layout) .tab-group-tab[data-active-tab="true"]::before {
- content: "";
- position: absolute;
- z-index: 2;
- top: -0.5px;
- right: 0;
- left: 0;
- height: 3px;
- border-radius: 9999px;
- background: var(--app-tab-active-accent, var(--ring));
- pointer-events: none;
-}
-
-.app-tab-bar:not(.vertical-tab-layout)[data-placement="bottom"] .tab-group-tab[data-active-tab="true"]::before {
- top: auto;
- bottom: -0.5px;
-}
-
.app-tab-bar:not(.vertical-tab-layout):not(:has(.wrap-mode))[data-placement="bottom"] .tab-group-tab::after {
top: -0.5px;
bottom: auto;
@@ -1465,3 +1432,102 @@ html.dbx-legacy-webview .vertical-tab-layout .app-tab-pill:not(.tab-group-tab)[d
.vertical-tab-layout .tab-group-tab--first::after {
display: none;
}
+
+/* ------------------------------------------------------------------------- */
+/* Grouped tab selection */
+/* */
+/* Grouped tabs already carry their group color on the bottom edge, so the */
+/* selected state uses a single full-width group-colored underline instead */
+/* of a second accent on the opposite edge. Inactive rails stay quiet so the */
+/* selected tab stays easy to find among several colored groups. */
+/* ------------------------------------------------------------------------- */
+.app-tab-bar:not(.vertical-tab-layout):not(:has(.wrap-mode)) .tab-group-tab::after,
+.app-tab-bar:not(.vertical-tab-layout):has(.wrap-mode) .tab-group-entry:has(.tab-group-tab)::after,
+.app-tab-bar:not(.vertical-tab-layout):has(.wrap-mode) .tab-group-tab::after {
+ opacity: 0.3;
+}
+
+.app-tab-bar:not(.vertical-tab-layout):not(:has(.wrap-mode)) .tab-group-tab[data-active-tab="true"]::after,
+.app-tab-bar:not(.vertical-tab-layout):has(.wrap-mode) .tab-group-entry:has(.tab-group-tab[data-active-tab="true"])::after {
+ left: 0;
+ right: 0;
+ bottom: 0;
+ height: 2.5px;
+ background: var(--tab-group-color);
+ opacity: 1;
+}
+
+/* Wrapped rows paint a rail on each pill as well; the selected pill must use
+ * the group color there too, otherwise the quiet entry rail shows through. */
+.app-tab-bar:not(.vertical-tab-layout):has(.wrap-mode) .tab-group-tab[data-active-tab="true"]::after {
+ left: 0;
+ right: 0;
+ bottom: -0.5px;
+ height: 2.5px;
+ background: var(--tab-group-color);
+ opacity: 1;
+}
+
+/* Two-row grouped bars keep headers and pills on separate rows, so the 0.2rem
+ * overlap used to join them in the single-row strip reads as a stray overhang
+ * on the header's right edge. Drop it and keep both ends rounded. */
+.app-tab-bar.tab-two-row-groups .tab-group-header::after,
+.app-tab-bar.tab-two-row-groups .tab-group-tab::after {
+ left: 0;
+ right: 0;
+ border-radius: 9999px;
+}
+
+/* The selected grouped tab gets a very light same-hue gradient that fades
+ * upward, so the group color reads as depth instead of a flat tint. */
+.app-tab-bar:not(.vertical-tab-layout) .tab-group-tab[data-active-tab="true"] {
+ background-color: var(--background, #fff);
+ background-image: linear-gradient(
+ to top,
+ color-mix(in srgb, var(--tab-group-color) 12%, transparent),
+ color-mix(in srgb, var(--tab-group-color) 0%, transparent)
+ );
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
+}
+
+/* Classic layout injects a dark inset selected bar inline; grouped tabs use
+ * the group-colored underline instead, so override the inline shadow. */
+.app-tab-bar.classic-tab-layout:not(.vertical-tab-layout) .tab-group-tab[data-active-tab="true"] {
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.07) !important;
+}
+
+/* Group headers keep the label neutral so it stays readable on the tinted
+ * header background; the group color remains on the marker, rail and badge. */
+.app-tab-bar:not(.vertical-tab-layout) .tab-group-header {
+ color: var(--foreground);
+}
+
+.app-tab-bar:not(.vertical-tab-layout) .tab-group-header::after {
+ right: 0;
+}
+
+.app-tab-bar:not(.vertical-tab-layout) .tab-group-count {
+ color: color-mix(in srgb, var(--foreground) 72%, transparent);
+ background: color-mix(in srgb, var(--tab-group-color) 16%, transparent);
+}
+
+.app-tab-bar:not(.vertical-tab-layout) .tab-group-header--active .tab-group-header-content {
+ background: color-mix(in srgb, var(--tab-group-color) 12%, transparent);
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tab-group-color) 28%, transparent);
+}
+
+/* Vertical bars use the same neutral-label rule for the active group header. */
+.vertical-tab-layout .tab-group-header,
+.vertical-tab-layout .tab-group-header--active {
+ color: var(--foreground);
+}
+
+.vertical-tab-layout .tab-group-count {
+ color: color-mix(in srgb, var(--foreground) 72%, transparent);
+ background: color-mix(in srgb, var(--tab-group-color) 16%, transparent);
+}
+
+.vertical-tab-layout .tab-group-header:hover .tab-group-header-content,
+.vertical-tab-layout .tab-group-header--active .tab-group-header-content {
+ background: color-mix(in srgb, var(--tab-group-color) 10%, transparent);
+}