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

slideToClickedSlide not working when clicking on swiper-slide slot content #6958

Closed
5 of 6 tasks
Haerezis opened this issue Aug 21, 2023 · 0 comments
Closed
5 of 6 tasks

Comments

@Haerezis
Copy link

Check that this is really a bug

  • I confirm

Reproduction link

https://stackblitz.com/edit/vue3-script-setup-with-vite-siqjxo?file=src%2Fcomponents%2FAgeSelector.vue

Bug description

When clicking IN the swiper-slide content, the slideToClickedSlide doesn't work.

In the reproduction link, when clicking on the numbers text, nothing happens, but if I click on the space surrounding it inside it's border, then the slideToClickedSlide trigger.

From what I can understand, Swiper use the closest method on the target of the click, to get the closest swiper-slide, to which it will slide to. But when clicking on the content of the slot, then the target is inside the shadow DOM, and closest return nothing (but when clicking on the white space around it, then we click outside the shadow DOM).

Expected Behavior

slideToClickedSlide trigger when clicking on the content of the swiper-slide.

Actual Behavior

slideToClickedSlide does NOT trigger when clicking on the content of the swiper-slide (only work when clicking ou the space around, NOT in the shadow DOM).

Swiper version

10.1.0

Platform/Target and Browser Versions

Firefox

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
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

No branches or pull requests

1 participant