clientHeight can be greater than scrollHeight when zoomed.
Reported by
ptwa...@gmail.com,
Apr 20 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 Steps to reproduce the problem: 1. Open attached Zoom.html 2. Alter the browsers zoom level until scrollHeight is less than clientHeight. 3. Zoom level required to reproduce varies by machine. In chromium on arch linux I can reproduce at 80%, 250%, and 300%. In chrome on windows 7 I can reproduce at 67%, 75%, and 80%. What is the expected behavior? scrollHeight should always be greater than or equal to clientHeight. If scrollHeight is greater than clientHeight then a scrollbar should be visible unless the CSS style overflow is set to 'visible'. https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight What went wrong? At some zoom levels, scrollHeight is less than clientHeight which which can give a false positive when checking for scroll views. Did this work before? N/A Does this work in other browsers? Yes Chrome version: 57.0.2987.133 Channel: n/a OS Version: Arch Flash Version: Shockwave Flash 25.0 r0 The following bugs are similar but list scrollHeight > clientHeight as the issue where the opposite is true here. https://bugs.chromium.org/p/chromium/issues/detail?id=449702 https://bugs.chromium.org/p/chromium/issues/detail?id=261748 (example attachment derived) Not reproducible in firefox.
,
Apr 26 2017
I think this is an issue with layout and precision. I expect it's been around for a really long time so a bisect won't really help.
,
May 1 2017
scrollHeight and offsetHeight use different rounding modes to avoid triggering scrollbars unnecessarily and to allow scrollable containers to be scrolled to the bottom regardless of zoom level. While this might result in unexpected issues like this changing the rounding behavior for either will cause real-world websites to break. We can't really fix this without causing compat issues until we have LayoutNG. A reasonable workaround for now would be to use getBoundingClientRect().height instead of offsetHeight as the former is *not* rounded.
,
May 10 2017
Issue 716572 has been merged into this issue. |
|||
►
Sign in to add a comment |
|||
Comment 1 by bugsnash@chromium.org
, Apr 21 2017Status: Untriaged (was: Unconfirmed)