Skip to content

Rework of Lazy Preloader breaks swiper + preloader not working correctly #6946

@nikitasol

Description

@nikitasol

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-default-forked-75kk6t?file=%2Findex.html%3A52%2C37

Bug description

Two connected issues:

  • If swiper is initiated above the fold, the first slide should get loading="eager" and the rest loading="lazy". Update "10.2.0" changed Element lazy preloader lookup logic and now all slides have to use lazy="true" in order to work. Can be verified with npm run element adding some images.
  • Even if all slides have lazy="true" and images loading="lazy", the swiper is initialised correctly but preloader always stays visible and never disappears.

Expected Behavior

We should still be able to load the first slide without lazy in eager fashion for the above the fold content. The preloader has to disappear once the image is loaded.

Actual Behavior

No response

Swiper version

10.2.0

Platform/Target and Browser Versions

macOS Safari 16.4 and macOS Chrome 115

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