Skip to content

Commit

Permalink
fix: addresses issue #110 where input selection on a draggable item d…
Browse files Browse the repository at this point in the history
…id not work when using drag handles
  • Loading branch information
sashamilenkovic committed Jan 15, 2025
1 parent ed2dfe3 commit 681ce35
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,11 @@ export function handleNodePointerdown<T>(
) {
sp(data.e);

state.pointerDown = {
parent: data.targetData.parent,
node: data.targetData.node,
};

if (
!validateDragHandle({
x: data.e.clientX,
Expand All @@ -1515,11 +1520,6 @@ export function handleNodePointerdown<T>(
)
return;

state.pointerDown = {
parent: data.targetData.parent,
node: data.targetData.node,
};

handleLongPress(data, state, data.targetData.node);

const parentData = data.targetData.parent.data;
Expand Down
30 changes: 30 additions & 0 deletions tests/pages/input-selection/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script setup lang="ts">
import { useDragAndDrop } from "../../../src/vue/index";
const mockFileNames = [
"dungeon_master.exe",
"map_1.dat",
"map_2.dat",
"character1.txt",
"character2.txt",
"shell32.dll",
"README.txt",
];
const [parent1, files1] = useDragAndDrop(mockFileNames, {
dragHandle: ".drag",
});
</script>

<template>
<div class="file-manager">
<ul ref="parent1" class="file-list">
<li v-for="file in files1" :key="file" class="file">
<p class="drag">{{ file }}</p>
<input type="text" value="hello world" />
</li>
</ul>
</div>
</template>

<style scoped></style>

0 comments on commit 681ce35

Please sign in to comment.