In firefox (47.0.2 - latest) on windows it crashes when calling function getScrollbarWidth.
I manually checked in firefox console that this code:
getComputedStyle(document.body, '::-webkit-scrollbar').display throws the exception "Component is not available".
getComputedStyle(document.body, '::-webkit-scrollbar') itself doesn't crash though.
Anyways the solution seem to wrap the content of function getScrollbarWidth with try catch and return 0 in the catch.
Btw Firefox on Mac OS works good.
Btw Firefox on windows seems to be only browser where is the problem.
Btw Update of Firefox to latest version 56.0 didn't help.
I wanted modify the original code and use it, but i was unable to do it. (I use react + ts) so i fixed it with this temporary hack. Official solution still needed.
if (window.getComputedStyle) {
var old = window.getComputedStyle;
window.getComputedStyle = function(element: any, pseudoElt?: any) {
var ret = old(element, pseudoElt) || {};
if (pseudoElt == '::-webkit-scrollbar') {
try {
ret.display == 'none';
} catch (e) {
return {display: 'block'};
}
}
return ret;
} as any
}
Seems like the same issue as #395.
Are you on Windows XP as well? Because latest version of FF is 70 not 56.
So it seems like the throw/catch is the best solution :/ I'll release a fix soon! Thanks for your report.
Released a fix in latest version. Hope it helps.
windows 10, thanks for the fix, now it doesn't crash, cool
Most helpful comment
Released a fix in latest version. Hope it helps.