-
Notifications
You must be signed in to change notification settings - Fork 77
Change to getNativeScrollbarWidth (fixes issue #42) #45
Conversation
Hey @gregpabian, I'll need to test if this doesn't brake anything in other browsers and if everything will be good I'll merge this. Thank you! |
Hi @gregpabian, After investigating this it seems like original code is correct. I've tested Safari 9-11 and all have overlaying scrollbars. The
And unfortunately, in the last 2 cases, it's impossible to detect the overlaying scrollbar width and even existence. (But I would love to someone prove me wrong!) So when Vuebar has detected overlayed/0 scrollbar then it uses the constant value of 20px to overflow content. I've chosen 20px because it feels like safe value that will work in 99% of cases. I'll close this PR without merging, but if you don't agree with it then please comment here and I'll revisit it. |
@gregpabian, didn't know there's a possibility to choose scrollbar behavior on Safari. Thank you for showing it to me! I'll test it again soon, and get back to you with the findings. |
@gregpabian The same should apply to the "Always" option, regardless of any connected input device. I'm not entirely sure but seem to have the same problem you described in Safari. Thanks for this hint:
|
Yup, @gregpabian you were right. When the option was to "always" then getNativeScrollbarWidth didn't calculate it properly. I assume it was because "overflow: scroll" doesn't work on Safari as on other browsers (I think?) I'm merging this PR for Vuebar 0.0.18. As for 2.0 in development branch... I've changed this fix by making |
Appreciated @DominikSerafin! Can't wait to see Vuebar 2 in action! |
Change to getNativeScrollbarWidth (fixes issue #42)
Turns out the native scrollbar width calculation fails in Safari 11 (tested with 11.0.2). As the child element's
offsetWidth
still returns100px
after setting wrapper'soverflowY
toscroll
, the returned scrollbar width is0
. Setting child's width to100%
makes the browser report the correct offsetWidth, though.Fixes: #42