Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging slides (swipe) with mouse fires click event. #375

Closed
mkyoon opened this issue Apr 18, 2024 · 4 comments · Fixed by #396
Closed

Dragging slides (swipe) with mouse fires click event. #375

mkyoon opened this issue Apr 18, 2024 · 4 comments · Fixed by #396

Comments

@mkyoon
Copy link

mkyoon commented Apr 18, 2024

Describe the bug
After upgrade to v0.3.3,
dragging slides (swipe) with mouse fires click event.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://codesandbox.io/p/sandbox/vue3-carousel-example-01-forked-k2m47s'
  2. Drag with mouse on 'Carousel'
  3. After dragging, window opens 'google.com'

Expected behavior
v.0.3.3 : Dragging with mouse is just swipes slides. Not capturing click events.
v0.3.1 : Everything is OK.

Screenshots

Desktop (please complete the following information):

  • OS: Windows 10, macOS 14
  • Browser : chrome, safari (desktop)
  • Version : latest
@mkyoon
Copy link
Author

mkyoon commented Apr 19, 2024

Using 'isSliding' data, I could solve this issue.

@slide-start="isSliding = true"
@slide-end="isSliding = false"

Is there any clever way to bypass this click events?

@Chambo015
Copy link

same problem

@mkyoon
Copy link
Author

mkyoon commented Jun 4, 2024

I found this comment, and it works like a charm.
#343 (comment)

@Tofandel
Copy link
Contributor

Tofandel commented Sep 27, 2024

I can see this library is trying to prevent the event from firing but in a wrong way, it uses a form of .stopPropagation (3rd param of addEventListener) but only when the event has already reached window

https://github.com/ismail9k/vue3-carousel/blob/master/src/components/Carousel.ts#L225-L228

This will indeed not prevent a click from firing and it should instead run event.preventDefault() instead of trying to capture the event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants