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

Accessibility issue: Focusing on input forces slider to jump #5962

Closed
6 tasks done
wisniowski opened this issue Aug 16, 2022 · 4 comments
Closed
6 tasks done

Accessibility issue: Focusing on input forces slider to jump #5962

wisniowski opened this issue Aug 16, 2022 · 4 comments

Comments

@wisniowski
Copy link

wisniowski commented Aug 16, 2022

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/embed/swiper-slides-per-view-forked-n8pht9?fontsize=14&hidenavigation=1&theme=dark

Bug description

Hello,

everything works just great in 99% of scenarios, although I found an odd bug that causes the slider to roughly jump once the input field gets focused - it doesn't even swipe, it simply instantly jumps to another section.

Expected Behavior

When input/textarea gets focused, swiper should stay.

Actual Behavior

When input/textarea gets focused, swiper jumps oddly (it doesn't even swipe).

Swiper version

8.3.2

Platform/Target and Browser Versions

All

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
@wisniowski wisniowski changed the title Focusing on input forces slider to jump Accessibility issue: Focusing on input forces slider to jump Aug 17, 2022
@conniesmits
Copy link

I have also encountered this problem so hopefully this will be fixed soon, because now we are forced to use an old version of swiper in our project.

@mo3az96
Copy link

mo3az96 commented Sep 7, 2022

to workaround disable accessibility (if you don't need accessibility feature) by adding
a11y: {
enabled: false,
},
to your swiper options

@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

@davidmarquis
Copy link

davidmarquis commented Dec 2, 2024

The more appropriate workaround if you don't want to completely disable all accessibility options is to set the scrollOnFocus option specifically:

a11y: {
  scrollOnFocus: false,
},

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

5 participants