fix(tabs): make vertical tab rail width follow mouse while dragging

This commit is contained in:
一颗红心 authored and GitHub committed 2026-09-22 17:18:19 +08:00
1 parent f652491198
commit 3c0cce8ce2
4 files changed
+91 -14

No files matched your search

@@ -175,13 +175,12 @@ const isWrapLayout = computed(() => !isVerticalLayout.value && settingsStore.edi
// The icon-only collapse only exists in the vertical toolbar; horizontal
// placements must ignore the persisted collapse state entirely.
const isTabBarCollapsed = computed(() => isVerticalLayout.value && !!props.tabBarCollapsed);
// Outer [data-workspace-tab-navigation] / [data-special-page-navigation] owns
// the shared vertical rail width; fill that rail so nested pane bars stay in
// sync while the resize handle updates the outer panel (issue #9977).
const tabBarStyle = computed<CSSProperties | undefined>(() => {
if (!isVerticalLayout.value) return undefined;
if (props.tabBarCollapsed) {
return { width: "100%", flex: "0 0 100%" };
}
const width = props.tabBarWidth ?? 240;
return { width: `${width}px`, flex: `0 0 ${width}px` };
return { width: "100%", flex: "0 0 100%" };
});
const tabBarCollapseIcon = computed(() => {
const isLeft = settingsStore.editorSettings.tabPlacement === "left";
@@ -356,11 +356,11 @@ describe("AppTabBar group navigation portal", () => {
const rail = element(host, "[data-workspace-tab-navigation]");
const bar = element(rail, "[data-main-tab-bar]");
expect(rail.style.width).toBe("260px");
expect(bar.style.width).toBe("260px");
expect(bar.style.width).toBe("100%");
navigation.width = 320;
await settle();
expect(rail.style.width).toBe("320px");
expect(bar.style.width).toBe("320px");
expect(bar.style.width).toBe("100%");
navigation.collapsed = true;
await settle();
expect(rail.style.width).toBe("var(--collapsed-tab-rail-width)");
@@ -369,7 +369,7 @@ describe("AppTabBar group navigation portal", () => {
navigation.collapsed = false;
await settle();
expect(rail.style.width).toBe("320px");
expect(bar.style.width).toBe("320px");
expect(bar.style.width).toBe("100%");
expect(warnings).toEqual([]);
});