fix(desktop): prevent window drag from tab whitespace

Closes #10194
This commit is contained in:
t8y2 committed 2026-09-26 14:27:19 +00:00
1 parent b4f503e1f1
commit ed863e9e59
4 files changed
+67 -1

No files matched your search

@@ -1755,7 +1755,7 @@ watch([() => props.specialPageTabs?.settingsActive, () => props.specialPageTabs?
</div>
</CustomContextMenu>
</template>
<div v-if="!section.pinned" :class="tabTailDragRegionClass" data-tauri-drag-region />
<div v-if="!section.pinned" :class="tabTailDragRegionClass" data-tauri-drag-region="false" />
</div>
</div>
</template>
@@ -149,6 +149,16 @@ describe("always-on-top button visibility", () => {
setActivePinia(pinia);
});
it("keeps the actual title bar on Tauri's intentional native drag path", async () => {
const { host, unmount } = mount(AppToolbar, toolbarProps);
await settled();
expect(host.querySelector(".app-toolbar")?.getAttribute("data-tauri-drag-region")).toBe("");
expect(host.querySelector('.app-toolbar > [data-tauri-drag-region=""]')).not.toBeNull();
unmount();
});
it("hides the main toolbar pin control until the appearance setting opts in", async () => {
const settingsStore = useSettingsStore();
const { host, unmount } = mount(AppToolbar, toolbarProps);
@@ -177,6 +177,33 @@ describe("EditorGroupTabBar behavior", () => {
host.remove();
});
it("keeps a focus-return click on tab-strip whitespace out of native window dragging", async () => {
const store = useQueryStore();
const firstId = store.createTab("pg-1", "app", "Query 1", "query");
const secondId = store.createTab("pg-1", "app", "Query 2", "query");
const mainGroup = store.groups[0];
const activated: string[] = [];
const { app, host } = mountBar(mainGroup.id, [firstId, secondId], firstId, pinia, (tabId) => activated.push(tabId));
await settle();
const tabTail = host.querySelector<HTMLElement>('[data-tauri-drag-region="false"]');
expect(tabTail).not.toBeNull();
window.dispatchEvent(new Event("blur"));
window.dispatchEvent(new Event("focus"));
tabTail!.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, button: 0, detail: 1 }));
tabTail!.click();
await settle();
expect(activated).toEqual([]);
tabPill(host, secondId).click();
await settle();
expect(activated).toEqual([secondId]);
app.unmount();
host.remove();
});
it("closes a tab tooltip when the pointer leaves the tab", async () => {
const store = useQueryStore();
const tabId = store.createTab("pg-1", "app", "Plugin", "query");