kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.33k stars 5.88k forks source link

Cannot read properties of undefined (reading 'setPosition') #4290

Open avroemans opened 4 months ago

avroemans commented 4 months ago

short description of the bug / issue, provide more detail below.

We noticed a lot of Javascript errors popping up on customers of our website. The Javascript error read: Cannot read properties of undefined (reading 'setPosition')

We couldn't reproduce this problem for now but we still see errors coming in. I checked the source of the library and found the root of the problem: ret = _[i].slick[opt].apply(_[i].slick, args); Sometimes _[i].slick is undefined for a undefined reason. I'm not sure how this could happen, but it looks like some extra validation needs to be put in place here. Also to create the Slick slider if it isn't present yet.

====================================================================

What is the expected behaviour?

No client-side javascript errors and a working Slick slider

====================================================================

What is observed behaviour?

Javascript errors and the slider possibly not working correcrly.

====================================================================

More Details

Issue seems to only occur on Android devices. image image

I am using jQuery 3.4.1 and Slick 1.8.1