views:

3274

answers:

4

I've already figured out that Firefox's sizing of textareas is buggy - it always adds one to your rows and cols settings. But I've decided to just ignore that. The problem is that Firefox also refuses to put in the vertical scrollbar, even if I type a friggin' short story into the box.

Am I doing something wrong (i.e. invalid)? Is there a workaround?

<textarea rows="1" cols="35" name="Cmnt1"></textarea>

(I want to use a one-row textarea instead of an input type=text precisely because the latter doesn't provide scrollbars. All the other browsers will give you a vertical scrollbar even on a one-row textarea.)

Note that this field will almost always contain just a single line of text, but it needs to accept more "just in case". A text input field is less than satisfactory (<-- understatement) because it always hides the overflow. In every other browser, a single-row textarea works exactly as I want. I vehemently disagree that what I want is a usability problem. Unfortunately, the way it behaves in Firefox is a usability problem.

Edit: turns out there's a bug with my installation of Firefox. :/

+1  A: 

Focus on the textarea, hit the return key.

This sounds like a pretty terrible idea, by the way.

Tyler Rash
Martha
It works perfectly for me, pasting or typing manually.
Tyler Rash
Are you saying that in Firefox, you have a textarea with rows=1, and you get a *vertical* scrollbar? What version of Firefox??
Martha
That's exactly what I'm saying. FF v3.0.10 / XPhttp://tylerrash.com/test.html
Tyler Rash
A: 

Try setting the height of the textarea to 1em with CSS (which means one line-height unit) and set the rows to a higher value.

edeverett
That doesn't work, or rather it results in exactly the same behavior as using rows="1". I just tried it, and the vertical scrollbars do not appear at any height setting below 2.7em.
Martha
Interesting - I would guess that is your answer. If you think this is a FF bug, do report it to them so they know about it. https://bugzilla.mozilla.org/
edeverett
+2  A: 

Try setting the overflow css property to "scroll". For example:

<textarea rows="1" cols="35" name="Cmnt1" style="overflow: scroll;"></textarea>

Edit: Sorry, should be overflow-y: scroll.

DLH
This doesn't help. Neither does "overflow:auto". "Scroll" will make the horizontal scrollbar appear at all times, and "auto" has no effect. Neither setting will make the <i>vertical</i> scrollbar appear.
Martha
What about "overflow-y:scroll"?
DLH
It seems I'm not the only one seeing different behavior than you are. "It works perfectly for me, pasting or typing manually. – Tyler Rash"Using "overflow-y:scroll" causes a vertical and only a vertical scrollbar to show up in the textarea at all times in my browser unless I set the height manually with CSS. I'm not sure what the difference is between our browsers, but I do not appreciate your "less polite" comments.
DLH
Ok, it seems that the problem is with my particular installation of Firefox. I just installed FF on a different computer, and got lovely vertical scrollbars. Thanks for your help.
Martha
A: 

I am using Firefox 2.0. The scrollbar on the textarea does not show up until the height of the textarea is 32px (which is about two lines of text). If the height is less than that the scrollbars disappear -- probably because there is not enough room to show the arrow icons.

Emily