You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a website that uses Swiper Element. There are multiple components that wrap it to provide custom options so the init="false" is used in that cases. Because there can be multiple carousels inserted into the HTML at once, I wanted to split their initialisation into separate tasks to not block the main thread for too long.
The issue is that any delay in calling the .initialize() leads to a layout shift. This is caused by the fact that both <swiper-container> and <swiper-slide> call this.attachShadow() in their constructors. It makes the browser hide all of their content until initialize() moves all elements into slots.
Expected Behavior
I would expect the carousel to retain its appearance until the .initialize() function is called, especially when init="false" option is provided.
Actual Behavior
If the <swiper-container> and <swiper-slide> elements are already registered, they will hide their whole content until the .initialize() function is called.
Check that this is really a bug
Reproduction link
https://colorful-grizzled-oboe.glitch.me/
Bug description
I'm working on a website that uses Swiper Element. There are multiple components that wrap it to provide custom options so the
init="false"
is used in that cases. Because there can be multiple carousels inserted into the HTML at once, I wanted to split their initialisation into separate tasks to not block the main thread for too long.The issue is that any delay in calling the
.initialize()
leads to a layout shift. This is caused by the fact that both<swiper-container>
and<swiper-slide>
callthis.attachShadow()
in their constructors. It makes the browser hide all of their content untilinitialize()
moves all elements into slots.Expected Behavior
I would expect the carousel to retain its appearance until the
.initialize()
function is called, especially wheninit="false"
option is provided.Actual Behavior
If the
<swiper-container>
and<swiper-slide>
elements are already registered, they will hide their whole content until the.initialize()
function is called.Swiper version
v11.2.6
Platform/Target and Browser Versions
macOS, Chrome
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: