mercs600 / vue2-perfect-scrollbar

Vue.js wrapper for perfect scrollbar
https://mercs600.github.io/vue2-perfect-scrollbar/
MIT License
275 stars 43 forks source link

Bug: Cannot read property 'scrollTop' of null in "updateGeometry", on some mobile devices #31

Closed LucasGenoud closed 4 years ago

LucasGenoud commented 4 years ago

I haven't been able to reproduce this error myself but this error got trigged in our Sentry :

Cannot read property 'scrollTop' of null

This seems to be occuring in this function at the third line:

var updateGeometry = function(i) {
var element = i.element;
var roundedScrollTop = Math.floor(element.scrollTop);
i.containerWidth = element.clientWidth;
i.containerHeight = element.clientHeight;
i.contentWidth = element.scrollWidth;
i.contentHeight = element.scrollHeight;

It occurs on both IOS and Android, on chrome, firefox, safari but not consistently.

Let me know if you want some more details

mercs600 commented 4 years ago

Hi @LucasGenoud thank you for the information, but you have to notice that source code what are you talking about is the source of perfect-scrollbar library. This repository is only the wrapper for vuejs component. Have a look at it -> https://github.com/mdbootstrap/perfect-scrollbar/search?q=Cannot+read+property+%27scrollTop%27+of+null&type=Issues

LucasGenoud commented 4 years ago

Oh my bad, Thank you for your quick anwser !

hmoffatt commented 3 years ago

This has been fixed in perfect-scrollbar, but the faulty code is built in vue2-perfect-scrollbar.umd.js so there needs to be a release of vue2-perfect-scrollbar to pick up the fix.

Actually there also needs to be a release of perfect-scrollbar, because vue2-perfect-scrollbar depends on the built distribution in the other module.

mercs600 commented 3 years ago

@hmoffatt do you mean some fork or pull request of perfect-scrollbar ? where it was fixed ?

hmoffatt commented 3 years ago

I mean it's fixed on mdbootstrap/perfect-scrollbar master now (https://github.com/mdbootstrap/perfect-scrollbar/commit/e9f7439fb8ec1e294f893490cd4be6a19c359bb0), but it hasn't been released unfortunately.