Thanks to this issue: https://github.com/kenwheeler/slick/issues/3149

i found out where those unwanted divs came from. If rows is set to 1 instead of 0, the .slick__slide's are wrapped again in .slick-slide's + an classless div.

Patch follows.

Comments

thomas.frobieter created an issue. See original summary.

thomas.frobieter’s picture

gausarts’s picture

Category: Bug report » Task
Status: Active » Postponed (maintainer needs more info)
StatusFileSize
new187.46 KB

Thank you.

The library default value, and its docs sets rows to 1:
http://kenwheeler.github.io/slick/

If we changed it, it will break pre 1.8.1.

There is a different minimum value and logic to this between branches.

I don't know how to deal with it. We cannot simply change that number.

FYI, sometimes I prefer 1.6, and your patch will break that version.

If you have a better idea to handle this, please update.

This is not module bug, just library latest change, so worth a Task.

thomas.frobieter’s picture

Ok, yes, this is problematic.

I agree the problem is up to the library, but the chance they will fix this in the near future is nearly 0. And we should prevent others from wasting time on this problem?

Is it possible to show a warning message above a Slick settings configuration page, if library version is >1.8 AND a rows field is set to 1?
"'row' is set to 1, this will result in unnecessary markup, because of a Slick library bug. Consider to set 0 instead if you don't want to use the row feature."

Maybe you could do a break with the D9 release of this module.. require >1.8 and set the default to 0.. even if its against the slick default / documentation.

thomas.frobieter’s picture

Title: Fix ROWS setting default value & description (ROWS needs to be 0 instead of 1) » Fix ROWS setting default value & description (ROWS needs to be 0 instead of 1) / slick-slide has unnecessary wrappers

Updated the title so others can find this more easily.

gausarts’s picture

Yes, warning is less troublesome. Unless you have time to cross-check against versions.

Basically I don't know yet how to deal with different versions. I just checked, even the latest release still sets this to 1.

If made different, I have no time to verify against or simply read the library code if any is hard-coded or not with this value. No time to debug if any issue like what you have now across versions.

If anyone have free time and are confident to verify, feel free to proceed.

However if you should change it after confident checks, consider a hook update to change default optionset with the relevant line at slick.optionset.default.yml and likely the entire stored optionsets with careful checks such as those using this option bigger > 1, and those without, aside from your lines.

And any other place, if any. I hope not.

thomas.frobieter’s picture

Sorry, not much time at the moment, i didn't had a deeper look into this already.

Just one additional note to this problem: If "slides per row" is set to 0, the browser (especially Firefox) crashes. Maybe also worth a warning message... preventing others from debugging this shit.

gausarts’s picture

Issue tags: +slick gotchas

OK. Let's keep it open for a while, then.

Added tags for easy finding. Thanks for sharing.

thomas.frobieter’s picture

StatusFileSize
new1.46 KB

Ok done some testing with the Slick versions..

Seems the change was made in v. 1.9.0:

https://codepen.io/collection/APyjyZ

However, i've searched for ways to get the library version in Drupal, the only way here is the package.json and this feature is N/A yet in the libraries API: https://www.drupal.org/project/libraries/issues/2699799

So i've just checked if the critical values are set and print out messages.

Please double check my changes, i'm not a pro PHP developer ;)

gausarts’s picture

Status: Postponed (maintainer needs more info) » Needs review

That is helpful. Thank you.

Just few nits:

  • !empty() to isset() for just in case 0 is considered empty. Ignore if not.
  • drupal_set_message() was deprecated in favor of Messenger service. There is a sample at that SlickFormBase form at ::save().
  • t() to $this->t() unless for static methods.
  • https://www.drupal.org/project/slick/issues/3123787 to an accessible link.
thomas.frobieter’s picture

StatusFileSize
new1.57 KB

Thanks! Update attached.

thomas.frobieter’s picture

StatusFileSize
new1.65 KB

Damn it, sorry, forgot to copy over my latest changes, again!

gausarts’s picture

Thank you. Just one last bit.

I forgot to detail, sorry. The link should be put in a variable:
<a href=":url">...</a>

Then pass the value at the second param of t().

There is a similar sample on ::save too.

thomas.frobieter’s picture

StatusFileSize
new1.8 KB

NP, thanks for the advice.

gausarts’s picture

Status: Needs review » Fixed

Truly sorry for terrible delay.

This needs better handles, perhaps via JS for immediate hints.
Currently it is a bit confusing, and doesn't validate the installed version.

However it is better than broken :)

Added a space and minor message to avoid back and forth confusion:
, or leave it as if not using >1.9.0

Committed. Thank you for contribution and patience.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

gausarts’s picture

Title: Fix ROWS setting default value & description (ROWS needs to be 0 instead of 1) / slick-slide has unnecessary wrappers » [Slick 1.9.0] Fix ROWS setting default value & description (ROWS needs to be 0 instead of 1) / slick-slide has unnecessary wrappers
Parent issue: » #3196529: Support Accessible Slick