Skip to content

slidePrev() slides to the very first slide instead of the previous one in certain circumstances #8053

@hut36

Description

@hut36

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/objective-platform-7tw8mt

Bug description

After changing language direction to "rtl" then direction to "vertical", calling slidePrev() will goes to the very first slide, instead of the previous one.

Reproduction

  1. set initial direction to horizontal and language direction to ltr;
  2. click button 'lang direction rtl' to set language direction to rtl;
  3. click button 'direction vertical' to set direction to vertical;
  4. click button 'next' several times to go to the last slide;
  5. click button 'prev', it goes to the very first slide.

Expected Behavior

In the circumstance described in the above steps, click button 'prev' (slidePrev()) should go to the previous slide, instead of the first slide.

This unexpected behavior is observed only when first changing language direction to rtl followed by changing direction to vertical.

Actual Behavior

Calling slidePrev() goes to the very first slide.

Swiper version

11.2.10

Platform/Target and Browser Versions

macOS Safari 18.5 Firefox 141.0 Chromium 138.0.7204.157

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions