Incorrect measureScrollbar values on 1 of 5 computers running Chrome
See original GitHub issueIssue Description
On 20% of the Computers I tried and only on Chrome (however when they have the problem, they always have it, like my laptop always have the problem but my desktop is ok), the horizontal scrollbar shows up after calling autosizeColumns()
method. This bothered me for a while, and I just found the cause, it seems that the measureScrollbar()
method is 3px
short on these 20% of the computers and that makes the horizontal scrollbar appearing.
Some solutions
I tried running this Vanilla JS measureScrollbar or even this other one for jQuery and they both return me the correct value which is 17px
, but SlickGrid tells me it’s 14px
(always 3px short) and then the horizontal scrollbar shows up.
I can create a PR, but I would like some feedback before doing so.
In the mean time, I will make an extra resize of the ViewPort with 3px
to get rid of this annoying scroll bar (which again is only on 20% of the computers I’ve tried).
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (7 by maintainers)
The problem is solved, so no more action is necessary.
Just thinking if you were curious to see why this happened, you’d need to make the two divs visible and look at them with the inspection tools to see why the result is coming out as it is. You could do this if you make the offset small, the elements visible and don’t remove them after the test.
I’m not sure why the viewport is in there at all, is it to calculate the scrollbar only when the viewport needs it? Even if that is the case, its calculation is will still be wrong unless it’s calculated with the
body
which was the PR you merged.So anyway, I tried your suggestion to make the -10000px lower to -10px but that has no effect, let me know if there’s anything else you want me to try, as I said it always reproduce on my laptop (until I changed to
body
which fixed the issue).If you want to see what it does on my laptop, see the animated gif below.
The best code that I’ve found on the internet to calculate the scrollbar thickness is the following
Compare it to SlickGrid
measureScrollbar