Skip to content

Commit

Permalink
Only accept primary button for activating drag.
Browse files Browse the repository at this point in the history
Fix an issue on some platforms where the contextmenu shows on
right-click and intercepts the pointerup events that would cancel the
drag, leading to a sticky unintended drag.

For #30
  • Loading branch information
martinpengellyphillips committed Nov 2, 2022
1 parent 50da811 commit de6a277
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [Unreleased]

### Fixed

- Only accept primary button (left-click) for activating drag with default
pointer sensor. Fix an issue on some platforms where the contextmenu shows on
right-click and intercepts the pointerup events that would cancel the drag,
leading to a sticky unintended drag.

## [0.7.2] - 2022-10-07

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions src/create-pointer-sensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const createPointerSensor = (id: Id = "pointer-sensor"): void => {
let activationDraggableId: Id | null = null;

const attach: SensorActivator<"pointerdown"> = (event, draggableId) => {
if (event.button !== 0) return;

document.addEventListener("pointermove", onPointerMove);
document.addEventListener("pointerup", onPointerUp);

Expand Down

0 comments on commit de6a277

Please sign in to comment.