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

Multiple slides per view - Clicking links on mobile (or right click/scroll wheel click on desktop) jumps the clicked element to first position instead of opening the link #5814

Closed
6 tasks done
IonutG22 opened this issue Jun 22, 2022 · 8 comments

Comments

@IonutG22
Copy link

IonutG22 commented Jun 22, 2022

Check that this is really a bug

  • I confirm

Reproduction link

https://codepen.io/Ionut2022/pen/rNJEOgx

Bug description

In sliders with mutliple elements visible that contain a link, clicking on a slide on a mobile device (simulating touch with browser DevTools also works - refresh page after resizing the window), or right clicking/scroll wheel clicking an slide, jumps the clicked slide to the first position instead of opening the link.

The link opens correctly only when the slider is at the last slide, or clicking the first slide of the current view.

Edit: The problem appeared since version 8.0.0
Version 7.4.1 is the last version that works correctly: https://codepen.io/Ionut2022/pen/ZErdJEb

Expected Behavior

Clicking a slide that contains a link on a mobile device opens the link.
On desktop, scroll wheel clicking on a slide with a link, opens the link in new tab.

Actual Behavior

Clicking a slide with a link on a mobile device (other then the first slide in the current view), jumps the clicked slide to the first position and does not open the link.
Scroll wheel clicking a slide with a link, does not open the link and jumps the clicked slide to the first position.

Swiper version

8.2.4

Platform/Target and Browser Versions

Android Chrome / Windows Chrome

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
@laurenskling
Copy link

I have been debugging the same thing all morning now.

I have 3 slides in view, without centeredSlides, so the left one is the main one. Clicks on the left one will work (opening a modal). Clicks on slide 2 and 3 will make those slides jump to the left, as the main slide. Even tho slideToClickedSlide={false} (which i highly assume should stop this).

mouse click sliding also makes the slide jump to position 1 before sliding on mouseUp by the way.

Example: https://build-83da0753-50eb-44a2-b27d-cf1b36db2e7f.gtsb.io/voorraad/nieuw/microcar/2022/m-go-dci/must-sun-stb-5-jaar-garantie/1km/30961127/

@romain25
Copy link

romain25 commented Jul 5, 2022

Hi everyone, I have the same issue.

@voran
Copy link

voran commented Jul 15, 2022

+1

@MasterProvider
Copy link

add target="_blank" in the inside of your a tag to open a new tab

@dijkermans
Copy link

"or right clicking/scroll wheel clicking an slide, jumps the clicked slide to the first position instead of opening the link."

seems to be related with: #5625

@laurenskling
Copy link

Thanks @nolimits4web , just tested in and fixes the bug! Much appreciated

@Superhands89
Copy link

This is still an issue on mobile/touch devices in version 8.4.2

@Blacklightdesign
Copy link
Contributor

I have a solution that mobile touch on ui elements like links or select fields no longer makes the slide jump to first place. Touch events also trigger a focus event. I added a condition to check that the focus event was not triggered by touch.
#6139

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

8 participants