Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(desktop): keep tab clicks working under a stray full-screen pointermove (#10281)

rawlencee72045893d7e
diff --git a/apps/desktop/src/renderer/src/components/tab-bar.test.tsx b/apps/desktop/src/renderer/src/components/tab-bar.test.tsx
index e6034a29c7..2377dbdbc3 100644
--- a/apps/desktop/src/renderer/src/components/tab-bar.test.tsx
+++ b/apps/desktop/src/renderer/src/components/tab-bar.test.tsx
@@ -521,6 +521,28 @@ describe("TabBar overflow", () => {
});
});
+describe("TabBar click activation", () => {
+ // electron/electron#55100: in macOS native full screen on a secondary
+ // display, a press near the top of the window is followed by one pointermove
+ // offset by that display's position, without the pointer moving.
+ it("switches tabs when a press is followed by a far-off stray pointermove", () => {
+ const { getByRole } = render(<TabBar />);
+ const tab = getByRole("button", { name: "Projects" });
+
+ fireEvent.pointerDown(tab, {
+ button: 0,
+ isPrimary: true,
+ clientX: 300,
+ clientY: 16,
+ });
+ fireEvent.pointerMove(document, { clientX: 708, clientY: 998 });
+ fireEvent.pointerUp(document, { clientX: 300, clientY: 16 });
+ fireEvent.click(tab);
+
+ expect(state.setActiveTab).toHaveBeenCalledWith("tB");
+ });
+});
+
describe("TabBar context menu", () => {
it("opens an issue-detail tab as a dedicated window", async () => {
state.byWorkspace.acme.tabs = [
diff --git a/apps/desktop/src/renderer/src/components/tab-bar.tsx b/apps/desktop/src/renderer/src/components/tab-bar.tsx
index 89ac4087a5..f01eb230d1 100644
--- a/apps/desktop/src/renderer/src/components/tab-bar.tsx
+++ b/apps/desktop/src/renderer/src/components/tab-bar.tsx
@@ -528,7 +528,12 @@ export function TabBar() {
const sensors = useSensors(
useSensor(PointerSensor, {
- activationConstraint: { distance: 5 },
+ // `tolerance` cancels a press whose first move already lands far away,
+ // so it stays a click. In macOS native full screen on a secondary
+ // display, Electron sends exactly such a move right after a press near
+ // the top of the window (electron/electron#55100); started as a drag,
+ // it would swallow the tab click.
+ activationConstraint: { distance: 5, tolerance: 100 },
}),
);