Closed
Bug 304136
Opened 19 years ago
Closed 19 years ago
textarea element displays one more row than specified by the rows attribute
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: djn, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Firefox renders textarea elements 1 row higher than they should be, as specified
by the rows attribute. For example, the following HTML shows a textarea element
with three rows, not two as requested.
<html>
<body>
<textarea cols="35" rows="2" name="Summary" />
</textarea>
</body>
</html>
This behaviour is both intuitively wrong and is different to other browsers (eg.
IE and Opera), which behave as expected.
Reproducible: Always
Steps to Reproduce:
1. View page as specified in HTML included in the details section.
Actual Results:
Observe that the textarea element is three rows high.
Expected Results:
The textarea element should have been sized two rows high.
The HTML displaying the problem should, in fact, be:
<html>
<body>
<textarea cols="35" rows="2" name="Summary" />
</body>
</html>
I think that the last row is for the horizontal scroll bar.
Try entering a long text with no spaces into the textarea.
Comment 3•19 years ago
|
||
*** This bug has been marked as a duplicate of 33654 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
(In reply to comment #2)
> I think that the last row is for the horizontal scroll bar.
> Try entering a long text with no spaces into the textarea.
Ok, that sounds plausible, so this *possibly* isn't an actual bug (although see
my comments below).
The reason why this matters is that we have a web application that requests some
short summary text from the user. Our textarea is sized with rows="2" so that
the user is given a strong visual indication of how much text is desired (more
than a line, but preferably not an essay). The problem with the behavioural
inconsistency between Firefox and the other major browsers (as exampled by IE6
and Opera 8) is that this visual indication of the amount of required text is
different on different user agents for a given rows attribute value, and
therefore the utility of that attribute is greatly diminished.
I shall now attempt to convince that following IE/Opera would be superior to the
current Firefox behaviour :-)
The HTML 4.01 spec says of the cols attribute:
"Users should be able to enter longer lines than this, so user agents should
provide some means to scroll through the contents of the control when the
contents extend beyond the visible area. User agents may wrap visible text lines
to keep long lines visible without the need for scrolling."
Thus, although providing a scrolling mechanism is allowed, it is not required,
as forcibly wrapping the visible text lines is also an option that a user agent
can take.
1. The desire for broad consistency with other browsers (where they are
conformant with the relevant recommendations) would suggest that behaving in the
same way as IE and Opera would be preferable. As already described, behaving
inconsistently lessens the usefulness of sizing textareas to give usability
hints to the user.
2. Since Firefox will already wrap the content text if it contains spaces, the
need for a horizontal scrollbar to appear is actually likely to be extremely
rare. This is because users will generally be entering words separated by spaces
(thus giving the user agent opportunities for wrapping lines at spaces) into the
textarea. The case where a long sequence of characters unbroken by a space is
entered must surely be far less common. Therefore, sizing the textarea correctly
for the least common case seems less than optimal. The alternative of sizing the
textarea to be the correct height for the specified number of rows and then
having the horizontal scrollbar eat into that space when/if it appears, would be
just as viable. Thus, there exists a better alternative to the current
behaviour, even if it is deemed that following the behaviour of IE and Opera is
not desirable.
3. (2) might be objected to on the grounds that a textarea with attribute
rows="1" would consist purely of a horizontal scrollbar, if an unbroken string
of non-space characters were entered. However, this is an extremely unlikely
scenario -- a text input field would almost certainly be used by a page designer
in preference to a textarea one row high. In any case, if thought to be a
serious objection, the rows="1" situation could be treated as a special case.
4. Intuition (i.e. the desireability of having the user agent do the least
surprising with a given chunk of HTML) would suggest that it is unhelpful to
have a textarea *three* rows high output when a textarea *two* rows high is
requested.
You need to log in
before you can comment on or make changes to this bug.
Description
•