autosize
autosize copied to clipboard
Use of box-sizing: border-box always causes vertical scrollbar in IE
May be related to https://github.com/jackmoore/autosize/issues/226.
If you have a TEXTAREA with box-sizing: border-box, then the plugin is setting overflow-y to visible in all IE browsers, causing a vertical scrollbar to appear even though the content fits within the textarea.
In other browsers (tested in Chrome and Firefox), the plugin is setting overflow-y to hidden.
See http://jsfiddle.net/9tqt0z7j/2/. Note that in this example, I'm not setting overflow or overflow-y myself - just box-sizing, padding, and resize, but box-sizing is the only thing that matters.
Note: A partial workaround is to set overflow-y: auto!important against the affected TEXTAREA elements. However, in IE 11, there is still a somewhat jarring flicker when the textarea grows - you see the vertical scrollbar appear momentarily and then disappear. Also, for some reason this workaround doesn't work in IE9 - I still get the vertical scrollbar when I put more than two lines of text in the textarea.
The problem is here
if (style.height !== ta.style.height) {
On IE getComputedStyle().height doesn't adapt to 'border-box' and always returns the inner content area height. However 'ta.style.height' does change and includes the border. So they can't directly be compared. Other browsers adapt both.
I am experimenting with changing to the following
if (ta.scrollHeight > ta.clientHeight) {
The problem is still not solved (version 3.0.20). Unfortunately, I, will hardly have time to solve it.