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

Cannot use string array for wrapperClass since 6.5.9 #4680

Closed
mxlle opened this issue Jun 15, 2021 · 5 comments
Closed

Cannot use string array for wrapperClass since 6.5.9 #4680

mxlle opened this issue Jun 15, 2021 · 5 comments

Comments

@mxlle
Copy link

mxlle commented Jun 15, 2021

  • Swiper Version: 6.5.9, probably related to commit
  • Platform/Target and Browser Versions: e.g. macOs Chrome

What You Did

Setting the default wrapperClass + a custom wrapper class by using an array
<swiper [wrapperClass]="['swiper-wrapper', 'custom-swiper-wrapper']">

Working StackBlitz with version 6.5.8
Broken StackBlitz with version 6.5.9

Expected Behavior

We want to set an additional wrapper class to apply some custom styling, but also have the default styling of the .swiper-wrapper class.

This worked by using a string array, but is now broken since version 6.5.9

I realize that this was an undocumented feature, but as it used to work, it would be really great to keep it 😇

Actual Behavior

Component broken, several exceptions in console, because classes are not applied correctly.

@nolimits4web
Copy link
Owner

Don't expect something undocumented to work, and not sure why it was working:) You can just pass ['a', 'b'].join(' ') to wrapperClass to make a string from classes

@mxlle
Copy link
Author

mxlle commented Jun 16, 2021

Don't expect something undocumented to work, and not sure why it was working:) You can just pass ['a', 'b'].join(' ') to wrapperClass to make a string from classes

I tried that too, but it doesn't work... To get the wrapperEl you use $el.children(`.${swiper.params.wrapperClass}`) in your code which will fail. I think this must have changed too, as it was working before.

Could we maybe tag this as feature request instead then?

@mxlle
Copy link
Author

mxlle commented Jun 16, 2021

Actually for now we can just use <swiper class="custom-swiper-wrapper">
My colleague just pointed me to this, that the mentioned commit above actually changed the behaviour to attach the class of the root level to the wrapper div.

Though this too isn't documented 😕

@nolimits4web
Copy link
Owner

Yeah, that is a bug for sure :) and already removed here 1285195

@nolimits4web
Copy link
Owner

Add support for this to the core

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

No branches or pull requests

3 participants