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

focusableElements with allowTouchMove doesn't work #5878

Closed
6 tasks done
yasurev86 opened this issue Jul 13, 2022 · 3 comments
Closed
6 tasks done

focusableElements with allowTouchMove doesn't work #5878

yasurev86 opened this issue Jul 13, 2022 · 3 comments
Labels

Comments

@yasurev86
Copy link

yasurev86 commented Jul 13, 2022

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/s/brave-kilby-rfulow

Bug description

focusableElements: false with allowTouchMove: false
do not work together

Expected Behavior

when you click on the button in the slide, the prescribed handler is triggered

Actual Behavior

the slide is changed, after which the button becomes available for clicking

Swiper version

8.3.0

Platform/Target and Browser Versions

Windows Chrome, 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
@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

@stale
Copy link

stale bot commented May 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 21, 2023
@Sefibrah
Copy link

This is how I solved this issue in my Angular project, hopefully, it's replicable in other scenarios. Instead of providing the swiper container allowTouchMove directly in the template as such:

// this DOESN'T WORK (for me at least)
<swiper-container [allowTouchMove]="false"> 
  // stuff
</swiper-container>

Instead, I did the following. In my home.component.ts I added an options variable:

@Component({ .. })
export class HomeComponent {
  mySwiperOptions: SwiperOptions = {
      allowTouchMove: false,
      // other swiper options
  }
}

And provided this variable to the swiper container in my home.component.html like so:

<swiper-container [options]="mySwiperOptions"> 
  // stuff
</swiper-container>

Hopefully, this helps someone 😁

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

No branches or pull requests

4 participants