-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Vertical scrollbars when browser zoom level <> 100% #306
Comments
Autosize doesn't do any rounding, it uses getComputedStyle specifically to get subpixel values, but it looks like the browser is maybe returning an rounded value for scrollHeight? Not sure yet, may be related to this Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=447902 |
Ok, so this definitely seems like a Chromium bug. If I set zoom to 110% and set the textarea height style to a whole number of pixels, window.getComputedStyle may return a floating point value. For example: var ta = document.querySelector('textarea');
ta.style.height = '1336px';
window.getComputedStyle(ta).height; // 1335.99px This exact example may not work for you depending on your doc. May also depend on your pixelDeviceRatio. I'll round the getComputedStyle result to work around this. |
That should get it. Thanks! |
Thanks for the quick response and fix! Just tested it in my app and the problem is gone. |
In Google Chrome, on zoom levels other than 100%, vertical scrollbars sometimes (not always) appear, allowing for 1px scroll up and down. So far, while testing, the best bet to get steady results is setting line-height inside the textarea to 150%. I mention this because it may tell something about the origin of the problem.
It feels like somewhere the calculated height is rounded down in stead of up, but this is just guessing.
The text was updated successfully, but these errors were encountered: