svelte-dnd-action 0.9.60 → 0.9.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2695,10 +2695,19 @@
2695
2695
  // preventing default to prevent lag on touch devices (because of the browser checking for screen scrolling)
2696
2696
  e.preventDefault();
2697
2697
  isItemsDragDisabled.set(false);
2698
+
2699
+ // Reset the startDrag/isItemsDragDisabled if the user releases the mouse/touch without initiating a drag
2700
+ window.addEventListener("mouseup", resetStartDrag);
2701
+ window.addEventListener("touchend", resetStartDrag);
2698
2702
  }
2699
2703
  function handleKeyDown(e) {
2700
2704
  if (e.key === "Enter" || e.key === " ") isItemsDragDisabled.set(false);
2701
2705
  }
2706
+ function resetStartDrag() {
2707
+ isItemsDragDisabled.set(true);
2708
+ window.removeEventListener("mouseup", resetStartDrag);
2709
+ window.removeEventListener("touchend", resetStartDrag);
2710
+ }
2702
2711
  isItemsDragDisabled.subscribe(function (disabled) {
2703
2712
  handle.tabIndex = disabled ? 0 : -1;
2704
2713
  handle.style.cursor = disabled ? "grab" : "grabbing";
package/dist/index.mjs CHANGED
@@ -2689,10 +2689,19 @@ function dragHandle(handle) {
2689
2689
  // preventing default to prevent lag on touch devices (because of the browser checking for screen scrolling)
2690
2690
  e.preventDefault();
2691
2691
  isItemsDragDisabled.set(false);
2692
+
2693
+ // Reset the startDrag/isItemsDragDisabled if the user releases the mouse/touch without initiating a drag
2694
+ window.addEventListener("mouseup", resetStartDrag);
2695
+ window.addEventListener("touchend", resetStartDrag);
2692
2696
  }
2693
2697
  function handleKeyDown(e) {
2694
2698
  if (e.key === "Enter" || e.key === " ") isItemsDragDisabled.set(false);
2695
2699
  }
2700
+ function resetStartDrag() {
2701
+ isItemsDragDisabled.set(true);
2702
+ window.removeEventListener("mouseup", resetStartDrag);
2703
+ window.removeEventListener("touchend", resetStartDrag);
2704
+ }
2696
2705
  isItemsDragDisabled.subscribe(function (disabled) {
2697
2706
  handle.tabIndex = disabled ? 0 : -1;
2698
2707
  handle.style.cursor = disabled ? "grab" : "grabbing";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svelte-dnd-action",
3
3
  "description": "*An awesome drag and drop library for Svelte 3 and 4 (not using the browser's built-in dnd, thanks god): Rich animations, nested containers, touch support and more *",
4
- "version": "0.9.60",
4
+ "version": "0.9.61",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/isaacHagoel/svelte-dnd-action.git"
@@ -84,11 +84,22 @@ export function dragHandle(handle) {
84
84
  // preventing default to prevent lag on touch devices (because of the browser checking for screen scrolling)
85
85
  e.preventDefault();
86
86
  isItemsDragDisabled.set(false);
87
+
88
+ // Reset the startDrag/isItemsDragDisabled if the user releases the mouse/touch without initiating a drag
89
+ window.addEventListener("mouseup", resetStartDrag);
90
+ window.addEventListener("touchend", resetStartDrag);
87
91
  }
92
+
88
93
  function handleKeyDown(e) {
89
94
  if (e.key === "Enter" || e.key === " ") isItemsDragDisabled.set(false);
90
95
  }
91
96
 
97
+ function resetStartDrag() {
98
+ isItemsDragDisabled.set(true);
99
+ window.removeEventListener("mouseup", resetStartDrag);
100
+ window.removeEventListener("touchend", resetStartDrag);
101
+ }
102
+
92
103
  isItemsDragDisabled.subscribe(disabled => {
93
104
  handle.tabIndex = disabled ? 0 : -1;
94
105
  handle.style.cursor = disabled ? "grab" : "grabbing";