Skip to content

Commit 8811099

Browse files
committed
Fix clicking on search box tabs
1 parent a29d6e7 commit 8811099

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

frontend/src/lib/utils/drag.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ export function useDrag<CustomData>(element: AnyRef<HTMLElement | undefined>, ha
3737
const touchActionBkp = value.style.touchAction;
3838
value.style.touchAction = "none";
3939

40+
const draggableBkp = value.draggable;
41+
value.draggable = false;
42+
4043
onCleanup(() => {
4144
value.style.touchAction = touchActionBkp;
45+
value.draggable = draggableBkp;
4246
});
4347
}
4448
}, { immediate: true });
4549

4650
useDomEventListener(elementRef, "pointerdown", (e) => {
4751
// Is called when starting to drag, but also when clicking. To distinguish, we set "started" to true only in the first pointermove event.
48-
e.preventDefault();
4952
dragData.value = {
5053
startX: e.clientX,
5154
startY: e.clientY,
@@ -57,12 +60,12 @@ export function useDrag<CustomData>(element: AnyRef<HTMLElement | undefined>, ha
5760
pointerId: e.pointerId,
5861
started: false
5962
};
60-
elementRef.value!.setPointerCapture(e.pointerId);
6163
});
6264

6365
useDomEventListener(elementRef, "pointermove", (e) => {
6466
if (dragData.value && e.pointerId === dragData.value.pointerId) {
6567
if (!dragData.value.started) {
68+
elementRef.value!.setPointerCapture(e.pointerId);
6669
Object.assign(dragData.value, {
6770
customData: handlers.onDragStart?.(),
6871
started: true

0 commit comments

Comments
 (0)