I want a textarea with no scrollbars. This is done by setting overflow to hidden. However, in Firefox, if I add a new line to the bottom of the textarea, that new line is not visible - the textarea fails to scroll down to the new line. How can I get Firefox to follow the IE/Opera behaviour, whereby if a new line is added, the textarea automatically scrolls down so that it can be seen, whether or not scrollbars are displayed?
+1
A:
The point of overflow:hidden is to hide the scrollbars and the extra content. If you add a line outside of the limits of the textarea, it is not supposed to display.
You might be able to bypass that with some javascript. My call would be to rethink your UI, but I don't have all the elements, so maybe I'm wrong about that.
marcgg
2009-10-26 14:09:27
So are you saying that the FF implementation is correct, and IE and Opera are wrong?
darasd
2009-10-26 14:35:18
I'm not sure. I'd say that the specs are blurry leaving room for interpretation :)
marcgg
2009-10-26 19:06:30
A:
Are you programmatically adding the new line of text, or is the user typing it?
Either way, you can scroll the textarea to the bottom with a bit of javascript:
textarea.scrollTop = textarea.scrollHeight;
scrollHeight is the total height of the content, including the hidden bits. scrollTop is the offset of the visible area from the top of the content.
Tim Davis
2009-11-19 14:48:36