Skip to content

Commit

Permalink
[css-sizing-3] Specify handling of line-wrapping in input controls si…
Browse files Browse the repository at this point in the history
…zed as min-content or max-content. #2141
  • Loading branch information
fantasai committed Mar 4, 2018
1 parent 8549aac commit a65303d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions css-sizing-3/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -803,31 +803,29 @@ Intrinsic Sizes</h3>
(the <l spec=html>[=raw value=]</l> in the case of <{textarea}>,
or the <a href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-value">value</a> in the case of <{input}>),
possibly transformed to a more human-readable and/or localized display format,
which is then treated as child <a>text runs</a> of the input control.
which is then treated as child <a>text runs</a> of the input control,
allowing <a>soft wrap opportunities</a>
only where the input control would actually allow wrapping
(whether keyed off of CSS properties or other, UA-internal constraints).
If the input control has designated placeholder text
to be overlaid in its value display area,
then that text is also measured for the purpose of calculating the content-based size--
whether or not the placeholder text is visible at the moment.
(Thus the content-based intrinsic size of the input control
is the larger of the size to fit the placeholder text and the size to fit the value.)

The UA may enforce a minimum
(such as the size required to contain a single zero-width character)
(such as the size required to contain a single zero-width character,
or the smallest usable size of a touch target)
on the form control’s
<a lt="min-content size">min-content</a> and <a>max-content sizes</a>
to ensure sufficient space for the caret
and otherwise maintain usability of the form control.

Issue: <code>&lt;input type=text></code> only ever displays its value on a single line.
This appears to be accomplished by "magic":
newlines are removed by a sanitization step on the <code>.value</code> setter,
and then single-line display is further applied via magic,
rather than the 'white-space' property in the UA stylesheet.
Thus, the ''width/min-content'' size should probably automatically treat it as if it had ''white-space: pre''.

Note:
This might be extended to <{iframe}> or other content-containing replaced elements
(see <a href="https://github.com/w3c/csswg-drafts/issues/1771">discussion</a>),
but text inputs are a major use-case,
but text inputs are a major use-case;
and being document-internal,
have the least additional complications.

Expand Down

0 comments on commit a65303d

Please sign in to comment.