Opened 11 years ago
Closed 11 years ago
#22136 closed Cleanup/optimization (fixed)
Textarea Widget Outputs Default cols & rows, overriding styles provided by CSS
Reported by: | Timothy Allen | Owned by: | Timothy Allen |
---|---|---|---|
Component: | Forms | Version: | 1.6 |
Severity: | Normal | Keywords: | textarea, rows, cols |
Cc: | Timothy Allen | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The default Textarea class in widgets.py has default attributes passed along to the HTML:
default_attrs = {'cols': '40', 'rows': '10'}
Since CSS is used for most styling across the web today, this seems like a step backwards. Is there any reason not to remove these defaults?
Change History (9)
comment:1 by , 11 years ago
follow-up: 3 comment:2 by , 11 years ago
Replying to FlipperPA:
Is there any reason not to remove these defaults?
At least backwards-compatibility. Now you can argue about whether it's a good reason :)
comment:3 by , 11 years ago
Replying to aaugustin:
Replying to FlipperPA:
Is there any reason not to remove these defaults?
At least backwards-compatibility. Now you can argue about whether it's a good reason :)
Textareas will still appear in any browser I know of regardless of providing rows and cols due to the HTML defaults. But point taken! :)
comment:4 by , 11 years ago
Status: | new → assigned |
---|
comment:5 by , 11 years ago
Cc: | added |
---|
comment:6 by , 11 years ago
Hasn't the CSS precedence over cols
and rows
attributes? If yes, then I don't see the point in removing them.
comment:7 by , 11 years ago
CSS will take precedence over the HTML attributes, so the textarea size should be pretty easy to override.
(In addition the django defaults seem like a good idea, because the HTML defaults result in a *tiny* barely-usable textarea).
comment:8 by , 11 years ago
Then all we need is to change the comment to something like "use slightly better defaults than HTML's 20x2 box".
I would support even more reasonable defaults, like 72x6, but that could break layouts relying on the current default size.
comment:9 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
In regards to the comment in the source:
# The 'rows' and 'cols' attributes are required for HTML correctness.
The rows and cols attributes in HTML are not required; in fact, if omitted, HTML defaults to 2 rows and 20 cols. Reference:
http://www.w3schools.com/tags/att_textarea_cols.asp
http://www.w3schools.com/tags/att_textarea_rows.asp