-
Notifications
You must be signed in to change notification settings - Fork 746
Description
See: whatwg/html#6807 for more context about the problem we'd like to solve. The TL;DR is that we'd like to allow the <textarea>
element to be sized to its contents a little easier. I.e.
We explored different solutions in the whatwg thread. Folks seem to prefer a CSS solution to this problem - hence this issue!
One way to achieve the "minrows"/"maxrows" in that issue is to use the "lh" unit. (Fortunately the "lh" unit works exactly the same way textareas are implemented today - in that they use the first available font to calculate the line-height).
E.g.
textarea {
min-height: 2lh;
max-height: 5lh;
}
The only thing we are missing is the ability to use the "actual"[1] intrinsic size of the textarea. There are a few different potential solutions here.
Today the intrinsic-size of a textarea will (roughly) read the "rows" attribute, and multiply this by the "lh" unit. We need a switch to instead read the "rows" attribute to be based on the actual number of lines. One potential solution is:
textarea-rows: auto | <number>
If "auto" was set the user-agent would read the number of lines, then multiply this by "lh" to get the intrinsic block-size for the text-area.
We could then map the rows attribute to a presentation style hint to this property.
cc/ @tabatkins @lilles
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status