Skip to content

Commit

Permalink
fix(Carousel): prevent mouse click when dragging (#1781)
Browse files Browse the repository at this point in the history
  • Loading branch information
mukundshah committed May 15, 2024
1 parent 3b97563 commit 4f0d00f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/composables/useCarouselScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const useCarouselScroll = (el: Ref<HTMLElement>) => {
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)
Expand All @@ -24,6 +25,8 @@ export const useCarouselScroll = (el: Ref<HTMLElement>) => {
function onMouseMove (e) {
e.preventDefault()

el.value.style.pointerEvents = 'none'

const delta = e.pageX - x.value

x.value = e.pageX
Expand Down

0 comments on commit 4f0d00f

Please sign in to comment.