The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 19:45 UTC
fix(web): a sidebar click no longer gets lost when the release reports no buttons (#34929)
Julius Marminge committed
Nov 12, 2026 at 00:02 UTC
1e848876eebde3614e0cf1676e24e97108bd212a
2 files changed
+20
-2
apps/web/src/components/Sidebar.pointer.browser.test.tsx
+16
@@ -71,6 +71,22 @@ describe("sidebar pointer lifecycle", () => {
71
expect(drag.onFinish).toHaveBeenCalledExactlyOnceWith(true);
72
});
73
74
+ // regression: #22058 a press that never became a drag must keep its click
75
+ it("keeps the click when a zero-button move precedes pointerup before activation", () => {
76
+ using _environment = setup();
77
+ const press = gesture();
78
+ document.dispatchEvent(pointer("pointermove", { clientX: 11 }));
79
+ document.dispatchEvent(pointer("pointermove", { buttons: 0, clientX: 12 }));
80
+ document.dispatchEvent(pointer("pointerup", { buttons: 0, clientX: 12 }));
81
+ const onClick = vi.fn();
82
+ document.body.addEventListener("click", onClick);
83
+ document.body.dispatchEvent(new MouseEvent("click", { bubbles: true }));
84
+ document.body.removeEventListener("click", onClick);
85
+
86
+ expect(press.onCancel).not.toHaveBeenCalled();
87
+ expect(onClick).toHaveBeenCalledOnce();
88
+ });
89
+
90
// regression: #17373 a zero-button release outside a drop target must cancel, not reorder
91
it("cancels a missed sidebar release without committing a reorder", () => {
92
using _environment = setup();
apps/web/src/components/Sidebar.pointer.ts
+4
-2
@@ -59,9 +59,11 @@ export class SidebarPointerSensor {
59
private move = (event: PointerEvent) => {
60
if (this.phase === "finished" || event.pointerId !== this.pointer.pointerId) return;
61
const coordinates = { x: event.clientX, y: event.clientY };
62
- // Desktop may report buttons=0 before pointerup; drop active context drags before cancelling sort.
62
+ // Desktop may report buttons=0 before pointerup: a pending press is released like pointerup so its
63
+ // click lands; an active drag drops context before cancelling sort.
64
if ((event.buttons & 1) === 0) {
64
- if (this.phase === "dragging") this.props.options.onDrop?.(coordinates);
65
+ if (this.phase === "pending") return this.finish(false);
66
+ this.props.options.onDrop?.(coordinates);
67
return this.cancel();
68
}
69
if (this.phase === "pending") {