Skip to content

Commit a65303d

Browse files
committed
[css-sizing-3] Specify handling of line-wrapping in input controls sized as min-content or max-content. #2141
1 parent 8549aac commit a65303d

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

css-sizing-3/Overview.bs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -803,31 +803,29 @@ Intrinsic Sizes</h3>
803803
(the <l spec=html>[=raw value=]</l> in the case of <{textarea}>,
804804
or the <a href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-value">value</a> in the case of <{input}>),
805805
possibly transformed to a more human-readable and/or localized display format,
806-
which is then treated as child <a>text runs</a> of the input control.
806+
which is then treated as child <a>text runs</a> of the input control,
807+
allowing <a>soft wrap opportunities</a>
808+
only where the input control would actually allow wrapping
809+
(whether keyed off of CSS properties or other, UA-internal constraints).
807810
If the input control has designated placeholder text
808811
to be overlaid in its value display area,
809812
then that text is also measured for the purpose of calculating the content-based size--
810813
whether or not the placeholder text is visible at the moment.
811814
(Thus the content-based intrinsic size of the input control
812815
is the larger of the size to fit the placeholder text and the size to fit the value.)
816+
813817
The UA may enforce a minimum
814-
(such as the size required to contain a single zero-width character)
818+
(such as the size required to contain a single zero-width character,
819+
or the smallest usable size of a touch target)
815820
on the form control’s
816821
<a lt="min-content size">min-content</a> and <a>max-content sizes</a>
817822
to ensure sufficient space for the caret
818823
and otherwise maintain usability of the form control.
819824

820-
Issue: <code>&lt;input type=text></code> only ever displays its value on a single line.
821-
This appears to be accomplished by "magic":
822-
newlines are removed by a sanitization step on the <code>.value</code> setter,
823-
and then single-line display is further applied via magic,
824-
rather than the 'white-space' property in the UA stylesheet.
825-
Thus, the ''width/min-content'' size should probably automatically treat it as if it had ''white-space: pre''.
826-
827825
Note:
828826
This might be extended to <{iframe}> or other content-containing replaced elements
829827
(see <a href="https://github.com/w3c/csswg-drafts/issues/1771">discussion</a>),
830-
but text inputs are a major use-case,
828+
but text inputs are a major use-case;
831829
and being document-internal,
832830
have the least additional complications.
833831

0 commit comments

Comments
 (0)