swiper icon indicating copy to clipboard operation
swiper copied to clipboard

Navigation button click sometimes propagate as image click

Open jirihajek opened this issue 2 years ago • 0 comments

Check that this is really a bug

  • [X] I confirm

Reproduction link

https://codesandbox.io/s/small-sky-d3w0ld

Bug description

When a navigation button is clicked, it sometimes propagates as a click to the underlying element. I.e, instead of moving to the next image(s), it follows a hyperlink that's a part of the <SwiperSlide/>.

Note that this does happen only sometimes! No matter what I tried, I wasn't able to determine what's the difference between DOM that causes/doesn't cause the issue. The sample project above does not exhibit the behavior, just shows the structure that can reproduce it.

I found out that the problem is in navigation.js, namely function onNextClick(e). When e.stopPropagation() is added there, all works fine. I understand that this bug report isn't perfect (I really tried!), but is there any reason why not to stop propagation there?

Expected Behavior

No response

Actual Behavior

No response

Swiper version

8.3.2

Platform/Target and Browser Versions

Windows Chrome 104

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • [X] 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

jirihajek avatar Aug 26 '22 08:08 jirihajek