From 4f0d00f7a6eebf05adceaf1e7c2869ad91949cf3 Mon Sep 17 00:00:00 2001 From: Mukund Shah <39938037+mukundshah@users.noreply.github.com> Date: Wed, 15 May 2024 16:03:51 +0545 Subject: [PATCH] fix(Carousel): prevent mouse click when dragging (#1781) --- src/runtime/composables/useCarouselScroll.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/composables/useCarouselScroll.ts b/src/runtime/composables/useCarouselScroll.ts index 69290f22ca..52728de51d 100644 --- a/src/runtime/composables/useCarouselScroll.ts +++ b/src/runtime/composables/useCarouselScroll.ts @@ -16,6 +16,7 @@ export const useCarouselScroll = (el: Ref) => { function onMouseUp () { el.value.style.removeProperty('scroll-behavior') el.value.style.removeProperty('scroll-snap-type') + el.value.style.removeProperty('pointer-events') window.removeEventListener('mousemove', onMouseMove) window.removeEventListener('mouseup', onMouseUp) @@ -24,6 +25,8 @@ export const useCarouselScroll = (el: Ref) => { function onMouseMove (e) { e.preventDefault() + el.value.style.pointerEvents = 'none' + const delta = e.pageX - x.value x.value = e.pageX