bobbingwide / vgc

VGC - Garden Vista Group theme
GNU General Public License v2.0
0 stars 0 forks source link

Slick-carousel slider broken after update to WordPress 6.1 #45

Open bobbingwide opened 1 year ago

bobbingwide commented 1 year ago

Originally raised as https://github.com/bobbingwide/gardenvista/issues/13

After update to WordPress 6.1 the carousel slider on the home page that displays garden buildings stopped working. All the user saw was a very large background image.

image

The JavaScript error in the console was:


Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute')
    at vt (jquery.min.js?ver=3.6.1:formatted:3162:18)
    at jquery.min.js?ver=3.6.1:formatted:3219:25
    at Function.each (jquery.min.js?ver=3.6.1:formatted:160:34)
    at s.fn.init.each (jquery.min.js?ver=3.6.1:formatted:78:22)
    at s.fn.init.addClass (jquery.min.js?ver=3.6.1:formatted:3218:44)
    at e.setSlideClasses (slick.min.js?ver=2131231235:1:33477)
    at e.buildOut (slick.min.js?ver=2131231235:1:7838)
    at e.init (slick.min.js?ver=2131231235:1:18890)
    at new <anonymous> (slick.min.js?ver=2131231235:1:2832)
    at i.fn.slick (slick.min.js?ver=2131231235:1:42781)

Note: The slick-carousel JavaScript was last released 5 years ago. 
It seems unlikely that raising an issue against the code will result in an official fix.
https://cdnjs.com/libraries/slick-carousel
bobbingwide commented 1 year ago

I reproduced the problem in a local development environment. WordPress 6.1 delivers a new version of jQuery ( 3.6.1 ), which must be incompatible with the slick-slider code.

I debugged the problem locally and found a quick and dirty workaround. Change the centerMode attribute to the jQuery('.houses').slick() call from true to false.

This re-enables the carousel.