ismail9k / vue3-carousel

Vue 3 carousel component
https://ismail9k.github.io/vue3-carousel/
MIT License
653 stars 162 forks source link

Anchor links (a tags) redirect the app to the new page after dragging, even prevented elements! #362

Closed Iran-110 closed 1 month ago

Iran-110 commented 4 months ago

Describe the bug If there is an anchor link (i.e. the <a> element) inside the <slide> tags, the app will redirect to the new page after dragging the link, even if you have prevented the default!

To Reproduce

~/pages/index.vue:

<template>
 <Carousel :items-to-show="2" wrap-around>
   <Slide key="1">
     <a href="/test" @click.prevent>First element.</a>
   </Slide>
   <Slide key="2">
     <a href="/test" @click.prevent>Second Element</a>
   </Slide>
 </Carousel>
</template>
<script setup></script>

~/nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['vue3-carousel-nuxt'],
});

Expected behavior Preventing the link from redirecting the page after dragging, because of @click.prevent (equivalents to @click="ev => ev.preventDefault()").

Demo For testing, please download the project and run it on your computer. vue3-carousel does not work in stackblitz. https://stackblitz.com/edit/vue3-carousel-link-tester?file=README.md

Desktop:

seryogassm commented 1 month ago

very annoying issue. @ismail9k could u please merge PR linked above (or better- to provide another fix, as with removing stop propagation captureClick method becomes useless) same issue - https://github.com/ismail9k/vue3-carousel/issues/222

ismail9k commented 1 month ago

Release vue3-carousel@0.3.3