fix(ui): start pointer drags only while the primary button is held (#1071)

On macOS, with an editable element focused and an input method active, WebKit can deliver a tap as pointerup then pointerdown, so drag trackers saw every later pointermove as a held button: one tap plus a pointer move started a phantom drag (file drag label, tab detach, tool window move) and the next tap dropped it. A drag now starts only from a move with the primary button down, a move without it cancels the press, and late button-less moves after a drag started are ignored so the drop is kept. Resizers, dialog drag/resize, pan and the review gutter end instead; the Project view also listens for pointercancel.

Refs #760

Co-authored-by: ntbang0901 <[email protected]>
Цей коміт міститься в:
ntbang0901 authored and GitHub committed 2026-11-04 01:31:10 +08:00
1 джерело a35e434376
коміт 555226a9bf
15 files changed
+180 -9

No files matched your search

+10 -1
Переглянути файл
@@ -113,7 +113,16 @@ describe("service reordering integration", () => {
const target = within(tree()).getByText("Gateway").closest('[role="treeitem"]')!;
Object.defineProperty(document, "elementFromPoint", { configurable: true, value: () => target });
const pointer = (el: Element | Window, type: string, y: number) =>
fireEvent(el, new MouseEvent(type, { bubbles: true, button: 0, clientX: 70, clientY: y }));
fireEvent(
el,
new MouseEvent(type, {
bubbles: true,
button: 0,
buttons: type === "pointerup" ? 0 : 1,
clientX: 70,
clientY: y,
}),
);
pointer(source, "pointerdown", 60);
pointer(window, "pointermove", 26);
expect(document.querySelector('[aria-hidden="true"][role="treeitem"]')).not.toBeNull();