-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-ui] ? Allow <textarea> to be sized by contents. #7542
Comments
Why not
Prior discussion in #2141 (comment). |
I didn't realized we have previously discussed this - that's great! I have a few concerns about overloading the by using the min-content / max-content keywords however.
The definition here will also need to be tweaked. Here you actually don't want it to be strictly the height of the content, rather you want to count the number of lines, then multiply that by the |
+1 to solving this, as well as sizing |
The CSS Working Group just discussed The full IRC log of that discussion<fantasai> Topic: Sizing <textarea> by contents<fantasai> github: https://github.com//issues/7542 <fantasai> iank_: form control elements all have some default intrinsic size, inline axis and block axis <fantasai> iank_: the way they calculate this is sometimes extra fun <fantasai> iank_: sometimes just a static number, e.g. radio/checkboxes <fantasai> iank_: the way that textarea works, it will more or less read the rows attribute and multiple that by the lh unit (effectively) <fantasai> iank_: this is not fallback or anything like that <fantasai> iank_: Since the dawn of time, ppl have wanted textareas to auto-expand <fantasai> iank_: a lot of libraries that do this <fantasai> iank_: most people want to show some minimum amount of rows <fantasai> iank_: and then let it grow <fantasai> iank_: I filed this issue, what's the best way forward with this <fantasai> iank_: I wasn't previously aware we discussed this 4-5 years ago <fantasai> iank_: I don't think proposed solution is the best, but can go from there <fantasai> iank_: was that enough background? <fantasai> iank_: I can sort of go through the previous proposal, and concerns with it <fantasai> iank_: I've also got an alternate proposal <fantasai> iank_: Previous proposal was to use the min-content/max-content and presumably fit-content keywords on the height <fantasai> iank_: when you specify this, you would flip the intrinsic size to calculate based on the rows <fantasai> iank_: to being based on content instead <fantasai> iank_: I have a few issues with this <fantasai> iank_: it creates a slightly weird discontinuity, currently on form controls there is an algorithm for calculating intrinsic size of form controls <fantasai> iank_: if you say height: auto; height: min-content; or height: fit-content, shoudl behave same <fantasai> iank_: other issue is it's difficult to feature-detect <fantasai> iank_: it also makes it difficult for layout algorithms, when flexbox or grid ask for min-content size of something, do we take into account <fantasai> iank_: very subtle <fantasai> iank_: the final thing is that, and we can debate this, there's a valid path forward <fantasai> iank_: a lot of the time you don't actually want it to be the exact height of the content <fantasai> iank_: 2 reasons <fantasai> iank_: 1, you want space for placeholder <fantasai> iank_: 2, you kindof want it to work the same as the lh unit <fantasai> iank_: if you set min-height: 2lh <fantasai> iank_: max-height: 4lh <fantasai> iank_: you want the content, the intrinsic size, to be based on the number of lines times the lh unit <fantasai> iank_: when you're typing and you fall back to a different font, can create a visual glitch <fantasai> iank_: I'll pause there ... <fantasai> iank_: My proposal is to add a new property, e.g. textarea-rows: auto | <integer> <TabAtkins> q+ <fantasai> s/integer/number/ <fantasai> iank_: You typically don't want to reserve space for the placholder <fantasai> florian: I'm confused about the proposal. I presume auto is the default? <fantasai> TabAtkins: no? <fantasai> TabAtkins: Then what's the default? <fantasai> iank_: ON the textarea, you have textarea-rows: 2 <fantasai> iank_: and then preshint mapping that maps rows attribute to this property <fantasai> florian: thanks, that helps <fantasai> iank_: today we have textarea-rows: <number> only <fantasai> iank_: and rows attribute would get mapped to this property <fantasai> florian: that makes more sense, thanks <astearns> ack TabAtkins <fantasai> TabAtkins: I agree with your reasoning against the older proposal to use max-content <fantasai> TabAtkins: max-content messes with our existing algorithms, and the fact that you do want this to be a multiple of lh <fantasai> TabAtkins: i was convinced by your arguments, so I support adding this property with the auto value <fantasai> iank_: I should also say that we can bikeshed the name, this is a very basic name <fantasai> florian: This new property is alternative to using height with lh? <fantasai> TabAtkins: if that's what you want to impose, yes <fantasai> iank_: It's useful even if you don't support lh unit <fantasai> iank_: currently looking at doing both atm <astearns> ack fantasai <TabAtkins> fantasai: I don't really like a new specialzied property to a single element <TabAtkins> fantasai: when we could get the same effect with a generic property <TabAtkins> fantasai: I think the feature detection is one we have for a lot of things <TabAtkins> fantasai: and that's not a reason to invent a new property every time <TabAtkins> q+ <florian> s/to using height with lh?/to using height with fit-content, but you'd use it in combination with min-height / max-height with lh?/ <TabAtkins> fantasai: in terms of other things being multiples of lh vs actual height, i think that's interesting <emilio> q+ <TabAtkins> fantasai: do we actually want that multiple-lh szie? or fit X lines? <TabAtkins> fantasai: can we figure out how to do that with the step-sizing properties? <TabAtkins> fantasai: if so we can apply it to other elements besides text area <TabAtkins> fantasai: other point wrt min/max content sizing <TabAtkins> iank_: discontinuity that height:auto and height:fit-content won't match <TabAtkins> fantasai: I don't think that's a discontinutiy - *usually* auto maps to a content keyword <TabAtkins> fantasai: but on some elements it maps to a fixed number <TabAtkins> fantasai: that's fine, auto can map to anything <TabAtkins> iank_: today auto doesn't map to a fixed number <TabAtkins> iank_: because the way most form elements work is that min/max-content returns a number, and auto maps to one of those <TabAtkins> fantasai: yeah but for some els auto maps to stretch <TabAtkins> iank_: yeah that's fine <TabAtkins> iank_: so like what happens when you do min-height:min-content; height:auto; on the textarea? <TabAtkins> fantasai: min-height would look at the number of lines in the box and come up with a height <TabAtkins> fantasai: and then auto would represent what it currently does <TabAtkins> iank_: which is fit-content <TabAtkins> fantasai: is it? isn't it a fixed number o flines/ <TabAtkins> iank_: For us and other engines, that's what fit-content means, yes <TabAtkins> iank_: if you say height:min-content today on a form control, it'll return a form control algo <TabAtkins> fantasai: so your concern is the backwards incompatibility of specifying a content keyword to have this behavior, rather than today's behavior <TabAtkins> iank_: I was considering if it was a compat problem, it's probably not. it's more how the engines work is that auto maps onto two things - stretch or fit-content <TabAtkins> iank_: and all the form elements behave similarly <TabAtkins> iank_: min/max-content is defined by some internal algo; for textarea it's rows*lh, basically <TabAtkins> iank_: and if you have height:min-content we swap the internal algorithm for that <TabAtkins> q+ <TabAtkins> fremy: a point that convinced me is you don't want to snap to any random pixel value, but a proper number of lines. can't rely on that with fit-content <TabAtkins> fantasai: content is quite limited; you can't format it <TabAtkins> TabAtkins: but you can have fallback fonts <TabAtkins> fantasai: yeah, but we already have problems with line heights from that <TabAtkins> fantasai: unsure if that's the reason we should add a specialized new property that only works for text areas <TabAtkins> fantasai: we should decide if we want the content to accommodate font changes and if we want a consistent line height we should be able to say that with text properties <fremy> q+ (other question) <TabAtkins> iank_: It's not affecting those line height, it's affecting the intrinsic size <florian> q+ <fremy> q+ <fremy> ack (other <fremy> ack question) <TabAtkins> fantasai: if height:auto effectively computed to 40px on a textarea, how would that be different fro mthe current situation we're in today? isn't that what's being proposed? <TabAtkins> iank_: it's not, auto only maps to stretch or fit-content <TabAtkins> fantasai: that's not true <TabAtkins> iank_: Where? <TabAtkins> fantasai: It's whatever we define it to be. <TabAtkins> iank_: Right but we don't do anything else today. Today it's just the two <TabAtkins> fantasai: I'd prefer to add a new concept ot the engines than to author-exposed stuff <TabAtkins> fantasai: I'd prefer not having authors have to learn a new concept <TabAtkins> iank_: what happens for things asking for min-content sizes? <TabAtkins> fantasai: typically asking for min-content contribution, not size <TabAtkins> fantasai: if auto resolves to an (effectively) fixed value, your contribution will be taht size <TabAtkins> [missed a bit] <astearns> ack TabAtkins <fantasai> TabAtkins: It seems 1 point of your objection is about having us this be a special-purpose property <fantasai> TabAtkins: I think for sufficiently magic element,s I think it's fine <fantasai> TabAtkins: we already have a large number of singe-purpose properties from SVG <fantasai> TabAtkins: I don't think it's a problem to add them to HTML also <astearns> ack emilio <dholbert> q+ <TabAtkins> emilio: one issue when consdiering whethe rto change height is that the default for textarea is border-box <TabAtkins> emilio: so it may not be right to match content there <dbaron> s/whethe rto/whether to/ <TabAtkins> fantasai: we don't have to change that - when you say height:max-content, you don't take the size and make the border-box that height <TabAtkins> emilio: I think for most purposes, block-size max-content is auto <TabAtkins> fantasai: auto is treated as intrinsic, rather <TabAtkins> fantasai: like in grid, it's stretch not auto <TabAtkins> emilio: I'm pretty sure we've discussed how intrinsic block sizes should behave and I'm 90% sure that our beahvior maps intrinsic block sizes to auto except in special cases <TabAtkins> fantasai: you're saying they're treated the same way, and you had "auto" first so you call it that in the codebase, but fundamentally it's the max-content size and "auto" maps to that <TabAtkins> emilio: Not convinced. If you do width:min-content and have box-sizing:border-box and have padding, do we add padding to that width? <TabAtkins> fantasai: yes, or else it would be broken <TabAtkins> dbaron: I think what's supposed to happen is if you're using width/height:intrinsic-stuff, box-sizing doesn't change the box affected <astearns> ack florian <emilio> ack emilio <TabAtkins> florian: One thing fantasai was concerned abou tis that this is a textarea-only property <TabAtkins> florian: But theoretically this could apply to any block container <TabAtkins> florian: So if you leave logical proeprties aside, couldn't this be a new set of properties that fit into the sizeing property? <fantasai> TabAtkins: that's step-sizing <dbaron> s/box affected/size of the box/ <astearns> ack fremy <TabAtkins> fremy: great segue <TabAtkins> fremy: i'm wondering about the issue of scrollbars <TabAtkins> fremy: textarea do overflow, and they get scrollbars which can change the lines on the screen <TabAtkins> iank_: we don't have have interop <TabAtkins> iank_: i think most engines do... something complicated <TabAtkins> iank_: effectively, if you have overflow:scroll, we'll reserve space <TabAtkins> iank_: if it's overflow:auto we won't reserve space <TabAtkins> iank_: it's like the text area has word-space;break-all on it <TabAtkins> iank_: very hard to trigger inline overflow <TabAtkins> iank_: if you do manage to trigger it it'll still be like two rows of overlap <TabAtkins> fremy: how do you know in advance what you'll need? <TabAtkins> fremy: will you get in a situation where if you don't have reserve the space it doesn't need a scrollbar? <TabAtkins> iank_: This varies engine by engine, but Chrome's behavior we won't... <TabAtkins> iank_: [compiles chrome in their head] <TabAtkins> iank_: it's complicated <TabAtkins> iank_: we'll only ever add scrollbars. that'll typically result in an extra row <TabAtkins> iank_: but we'll never remove them after that point <TabAtkins> fremy: makes sense <astearns> ack dholbert <TabAtkins> dholbert: going back to needing a special prop <TabAtkins> dholbert: one thing not clear to me is why we are reaching for a css proerty rather than an html attribute <fantasai> TabAtkins: Whether your item is content-sizable, might depend on the layout of the page <fantasai> TabAtkins: in some cases, might have the space, but might change based on MQ <florian> q? <fantasai> TabAtkins: so needs to be in CSS so you can change as needed <fantasai> TabAtkins: based on MQ and CQ <florian> q+ <astearns> ack florian <TabAtkins> florian: might have missed part of the discussion but didn't see the answer... <TabAtkins> florian: Can we do this with step-sizing? <TabAtkins> florian: How do we solve this with step-sizing? what's missing? <TabAtkins> iank_: where is step-sizing proposal <fantasai> https://www.w3.org/TR/css-rhythm-1/#block-step-size <Rossen_> q <fantasai> https://www.w3.org/TR/css-rhythm-1/#block-height <oriol> q+ <TabAtkins> iank_: where is this actually counting the number of lines? <TabAtkins> fantasai: you write 'block-step-size: 1lh' and it'll round your block to a multiple of 1lh <fantasai> TabAtkins: This doesn't address making textarea content-sizable in the first place <TabAtkins> iank_: there's nothing here that changes the way that the textarea calculates its size otherwise <astearns> ack oriol <fantasai> probably the spec should clarify that the intrinsic sizes are also stepped <TabAtkins> oriol: instead of step-sizing, i also remember in overflow there was a max-lines property <TabAtkins> oriol: [missed] <florian> q+ to respond to oriol <TabAtkins> oriol: what if we had as a pres hint converting the rows attribute into a max-lines, and if you want to size the textarea according to content, you set max-lines:none <astearns> ack florian <Zakim> florian, you wanted to respond to oriol <TabAtkins> florian: Havne't totally followed logic, but max-lines in overflow is a very different beast <TabAtkins> florian: it's fragmentation, not sizing <TabAtkins> florian: what it does with the nmber of lines is very different and doesn't work here <TabAtkins> florian: as a reminder, max-lines triggers a forced break after the number of lines if your container is a fragmentainer <TabAtkins> florian: I don't think we want forced breaks, we want to size things <TabAtkins> fantasai: also max-lines actually uses the line size, if one line is taller it breaks after a whole number of lines <TabAtkins> fantasai: also it's max-lines, if your block is max-lines:5 but has three lines in it, it'll still be 3 lines tall <TabAtkins> <br dur=15min> |
I missed this discussion, but here are my two cents about what was said:
|
Chrome and Safari currently implement |
Having actually |
Working well on Chrome v109 (Canary) with ezgif.com-gif-maker.mp4JS: static supportsCSSLineHeightUnit = CSS.supports('height', '1lh');
function resize() {
if (!TextArea.supportsCSSLineHeightUnit) {
const { lineHeight } = window.getComputedStyle(textarea);
this._lineHeight = lineHeight; // Calls style.setProperty('--line-height', newValue);
}
/* ... */ CSS: :host {
--line-height: var(--mdw-typescale__body-large__line-height);
}
@supports({width: 1lh}) {
:host {
--line-height: 1lh;
}
} Very happy to remove the |
One option that was brought up at the F2F was using the A simple proposal which uses this would be:
(Note see: #8620 that Combined with the
|
The CSS Working Group just discussed The full IRC log of that discussion<dael> iank_: The goal is to allow for textarea to grow number of content and grow in inline dimension with content<dael> iank_: Previously discussed to achieve with min intrinsic sizing property. Seems like a reasonable idea <dael> iank_: One way would be add 2 new values, one for textarea and one for input <dael> iank_: you would say min-intrsinzic-sizing and it would switch to being sized based on the area <dael> iank_: Any thoughts or concerns? <dael> astearns: Reason you are using the element names instead of something more generic like from-content? <vmpstr> q+ <astearns> ack fantasai <dael> iank_: They sort of work in different axes. textarea is in block and inputs are intrinsic for block dimension. If someone sets a reset it's not clear you want both so probably need indiviual control <dael> fantasai: I had the same question about why 2-axes. If we're splitting the axes we should maybe consider axis. Is it split on axis or on type of input? <dael> fantasai: And then is this going to change the way auto works? <dael> iank_: What do you mean by change how auto works? <dael> fantasai: When the input as an auto-width it currently sizes to a magic number <astearns> from-inline-content-size/from-block-content-size (for those who like to type a lot) <dael> iank_: full width for textarea we haven't heard demand to grow in inline size <dael> iank_: Is theoretically possible but I would prefer to keep. If we did it for both axes for textarea it would be weird behavior when they're in something like flexbox. Current magic is simple and looks at columns <dael> iank_: Prefer to keep textarea just for block. If we split min-intrinsic-sizing that's the other issue if we want to add it. <miriam> q+ <dael> vmpstr: <astearns> ack vmpstr <dael> vmpstr: I just wanted to ask for input if I spec from-input:min-intrinsic-size would the input shrink below default size? <dael> iank_: Correct. Expected webdev will put a min-width on that element <astearns> ack miriam <dael> miriam: I like this. For me your argument it does one thing on textarea and another on input seems like an argument for one value. Seems weird to align the right value to the right element <dael> miriam: Why do I need to say textarea as the target and the value rather than getting the right behavior <dael> iank_: Related to next issue which is splitting axes for min-intrinsic-sizing. Might be better to talk about that first. If we split that property in 2 than from-input would only apply to one. <dael> iank_: Could have a from-content but somewhat find that more difficult to understand. I think this is less magic. content is an overloaded word <dael> iank_: I like the explicitness of from-input and from-textarea <dael> astearns: I like solution of splitting min-intrinsic-size as a solution to the reset issue <dael> iank_: I would still come back to some content would be confusing <dael> iank_: It is possible; we could have intrinsic sized text areas in inline axis. I don't think it's desireable <dael> astearns: That's not part of current prop, right? <astearns> ack fantasai <dael> iank_: Correct. Future thing to keep in mind <dael> fantasai: I think this is workable. From author PoV I think the original proposal we had discused to use min and max-content feels more understandable. I'd prefer that if we can <dael> iank_: I don't think we can. Flexboxes are everywhere and it would change the auto min-size. We'd need an explicit switch for switching the algo similar to what min-instrinsic-size does for scrolling. We won't be able to shift that <dael> fantasai: What's the case wehre it changes behavior? <dael> iank_: A few. People use min-content/max-content on things already. Would change any input elements with this already. Other thing is it would change flexbox. Flexbox uses min-content size directly and that would change <dael> iank_: I think emilio tried to implement. I don't think we can shift it <dael> fantasai: Make sense to put keywords onwidth and height? Seems like a pretty indirect method. <dael> iank_: At the moment it's siwtching the algo we use to determine content size. All input elements and textarea have a special metric and this would default to the default. I think min-intrinsic-sizing is a good place to do this since the min size for scrollable is there also <dael> fantasai: I think I'd like to talk this over with TabAtkins. But I agree we need to solve the use case <dael> iank_: As long as it's not...been trying to come up with a proposal that satisfies everyone's desire for a while. I think this is the best so far <dael> fantasai: min-intrinisic-sizing property is about min and not intrinsic sizing. Or is this a new proposal? We have an intrinsic-sizing property. Is this separate? <dael> iank_: This is the original property <dael> fantasai: That's about how we find the min instrinsic size, but not about something like max intrinsic size. <dael> iank_: Weird thing about inputs is they're the same thing <dael> fantasai: Yeah, some elements don't have difference between min and max. A div with one word has equal min and max. <dael> iank_: Input elements that's also true <dael> fantasai: Right, b/c they have a fixed length intrinsic size. <dael> fantasai: We're trying to allow elements to be resized from their content. For a text area in block axis min and max will be the same. Concept does exist for difference if you want it <dael> fantasai: Would make sense if you tried to size as if they're a regular element you get that behavior. And you can't here because it's only giving one size. <dael> fantasai: Probably solves use case, but I think what makes sense is to make this behave more like a replaced element <dael> iank_: Specifically for input case you cannot get an input to wrap multiple lines <dael> fantasai: Yes, they're no-wrap <dael> iank_: You can't get min vs max for these elements today <dael> fantasai: But if we wanted to do something on inline axis for textarea there would be possible 2 sizes <dael> iank_: But no one is asking for that <dael> fantasai: I agree. I think if we can try and get everything to fit in that's a good directly <dael> fantasai: I think min-intrinsic-size...what min-width:auto resolves to is a little different from what is the intrinsic size. <dael> fantasai: I would rather try and talk this over with TabAtkins <dael> astearns: Can you commit to that over the next week? <dael> fantasai: If TabAtkins is available tomorrow or Friday, yeah. <dael> [discussion on TabAtkins availability] <dael> astearns: iank_ okay with you if we put this and 8620 on the agenda next week? <dael> iank_: Sure <dael> astearns: Next week we'll start with content-visibility and then this two issues |
OK, seems like we have three ways forward:
|
I would much prefer re-using existing syntax than expanding the language even more, and I share @fantasai's concerns about a new property. Also, I think it should be an antipattern to add syntax that only applies to specific types of elements (e.g. this is why we re-used I think we should explore the compat implications before we rule it out. I could ping the httparchive folks if that would be useful, but we need to formulate a query first. E.g. what about this: % of pages where there is at least one One thing that makes this a little tricky: when the form element is empty, you almost never want full-blown input sizing, because that would make it 0! You usually want a minimum width/height of 1 character / 1 line. This can be done with Also, the concept of input sizing needs to take placeholders into account. Generally, when there is no input, you want to use the placeholder for sizing (when one exists), rather than the empty string. |
We've observed that in the wild the auto-min sizing behaviour triggers a lot as acting as a floor. Developers often regularly under-size flexboxes (lots of different cases, but one example is when the flexbox is a scrollable area, and sometimes authros will explicitly set a flexbox to For option (1) switching the For option (2) the concern is similar. You might specify something like: |
@LeaVerou - This isn't the primary compat concern. The primary concern the is auto-min size behaviour. |
One additional thing to note here - We've previously had bugs with |
Yeah that's fine, the placeholder is content. It should Just Work.
Note: you want Wouldn't you usually be using If we do have such cases, is it actually form-specific, or is it a more general issue with wanting to apply multiple min/max constraints to an arbitrary element? If the latter, we should handle it in a generic way, such as by making min/max take a comma-separated list of constraints. |
Note that for an editable areas, rendering engines will preseve 1lh of height even if its empty to allow content to be added (there is an implicit minimum of 1lh). |
@bfgeek If the main problem is with |
Disregard my last (deleted) comment. Was concerned about |
Yes, I'd expect Of course, if we define it as a new value, I suppose it could have the reasonable minimum baked in. Are there any use cases where you don't want that minimum? |
I have to revert back to Edit: Sorry, keyboard was stuck and commented early. We would need a value that can be used with To reiterate @LeaVerou 's point from before:
I was able to get it work |
w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: Ia87e0fde1bd47eda5102da937365be268c9f92f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4930938 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Auto-Submit: Kent Tamura <tkent@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1208923}
w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: Ia87e0fde1bd47eda5102da937365be268c9f92f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4930938 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Auto-Submit: Kent Tamura <tkent@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1208923}
@brechtDR This is just about the intrinsic size, so you can always set e.g. The |
@hfhchan wrote:
Resizing iframes based on their contents is discussed in #1771. And it was resolved on adding a So that somewhat overlaps with your suggested In any case, I like the idea of introducing something that covers all the mentioned cases, as they are related. Sebastian |
I gave this some more thought of how this should play with intrinsic sizes of replaced elements, and I suggest renaming my previous proposal to Suppose you have an For form elements (input, select, textarea), it works either way to describe it as the intrinsic size no longer being platform defined but relying on the content, or the platform defined intrinsic size no longer applies and the element is laid out like a normal element. |
@hfhchan The |
…ormal -> fixed|content, a=testonly Automatic update from web-platform-tests form-sizing: Change the keywords: auto|normal -> fixed|content See w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: I21226d8216ae42254d4dc50d17e173884afd4e87 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4918050 Auto-Submit: Kent Tamura <tkent@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1206161} -- wpt-commits: 8a78be2625618f180b71e6b79d540637ac5c3866 wpt-pr: 42379
…eld-sizing`, a=testonly Automatic update from web-platform-tests Rename `form-sizing` CSS property to `field-sizing` w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: Ia87e0fde1bd47eda5102da937365be268c9f92f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4930938 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Auto-Submit: Kent Tamura <tkent@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1208923} -- wpt-commits: e93c967a027f4829a3a372f6f77788b84350a872 wpt-pr: 42505
…ormal -> fixed|content, a=testonly Automatic update from web-platform-tests form-sizing: Change the keywords: auto|normal -> fixed|content See w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: I21226d8216ae42254d4dc50d17e173884afd4e87 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4918050 Auto-Submit: Kent Tamura <tkent@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1206161} -- wpt-commits: 8a78be2625618f180b71e6b79d540637ac5c3866 wpt-pr: 42379
…eld-sizing`, a=testonly Automatic update from web-platform-tests Rename `form-sizing` CSS property to `field-sizing` w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: Ia87e0fde1bd47eda5102da937365be268c9f92f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4930938 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Auto-Submit: Kent Tamura <tkent@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1208923} -- wpt-commits: e93c967a027f4829a3a372f6f77788b84350a872 wpt-pr: 42505
This covers: - input element as a text entry widget size attribute is ignored if field-sizing:content - input element as domain-specific widgets (optional) - input element as a file upload control (optional) - select element size attribute is used only for dropdown/listbox switching if field-sizing:content - textarea element cols/rows are ignored if field-sizing:content Issue: whatwg#6807 Issue: w3c/csswg-drafts#7542
…ormal -> fixed|content, a=testonly Automatic update from web-platform-tests form-sizing: Change the keywords: auto|normal -> fixed|content See w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: I21226d8216ae42254d4dc50d17e173884afd4e87 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4918050 Auto-Submit: Kent Tamura <tkentchromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrickchromium.org> Cr-Commit-Position: refs/heads/main{#1206161} -- wpt-commits: 8a78be2625618f180b71e6b79d540637ac5c3866 wpt-pr: 42379 UltraBlame original commit: c52ba6b9925ecdb241d0ed0155708b90a2095664
…eld-sizing`, a=testonly Automatic update from web-platform-tests Rename `form-sizing` CSS property to `field-sizing` w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: Ia87e0fde1bd47eda5102da937365be268c9f92f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4930938 Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Auto-Submit: Kent Tamura <tkentchromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrickchromium.org> Cr-Commit-Position: refs/heads/main{#1208923} -- wpt-commits: e93c967a027f4829a3a372f6f77788b84350a872 wpt-pr: 42505 UltraBlame original commit: d7da5f7f79afc09619785ebe045c0eda04438026
…ormal -> fixed|content, a=testonly Automatic update from web-platform-tests form-sizing: Change the keywords: auto|normal -> fixed|content See w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: I21226d8216ae42254d4dc50d17e173884afd4e87 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4918050 Auto-Submit: Kent Tamura <tkentchromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrickchromium.org> Cr-Commit-Position: refs/heads/main{#1206161} -- wpt-commits: 8a78be2625618f180b71e6b79d540637ac5c3866 wpt-pr: 42379 UltraBlame original commit: c52ba6b9925ecdb241d0ed0155708b90a2095664
…eld-sizing`, a=testonly Automatic update from web-platform-tests Rename `form-sizing` CSS property to `field-sizing` w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: Ia87e0fde1bd47eda5102da937365be268c9f92f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4930938 Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Auto-Submit: Kent Tamura <tkentchromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrickchromium.org> Cr-Commit-Position: refs/heads/main{#1208923} -- wpt-commits: e93c967a027f4829a3a372f6f77788b84350a872 wpt-pr: 42505 UltraBlame original commit: d7da5f7f79afc09619785ebe045c0eda04438026
…ormal -> fixed|content, a=testonly Automatic update from web-platform-tests form-sizing: Change the keywords: auto|normal -> fixed|content See w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: I21226d8216ae42254d4dc50d17e173884afd4e87 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4918050 Auto-Submit: Kent Tamura <tkentchromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrickchromium.org> Cr-Commit-Position: refs/heads/main{#1206161} -- wpt-commits: 8a78be2625618f180b71e6b79d540637ac5c3866 wpt-pr: 42379 UltraBlame original commit: c52ba6b9925ecdb241d0ed0155708b90a2095664
…eld-sizing`, a=testonly Automatic update from web-platform-tests Rename `form-sizing` CSS property to `field-sizing` w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: Ia87e0fde1bd47eda5102da937365be268c9f92f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4930938 Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Auto-Submit: Kent Tamura <tkentchromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrickchromium.org> Cr-Commit-Position: refs/heads/main{#1208923} -- wpt-commits: e93c967a027f4829a3a372f6f77788b84350a872 wpt-pr: 42505 UltraBlame original commit: d7da5f7f79afc09619785ebe045c0eda04438026
This covers: - input element as a text entry widget size attribute is ignored if field-sizing:content - input element as domain-specific widgets (optional) - input element as a file upload control (optional) - select element size attribute is used only for dropdown/listbox switching if field-sizing:content - textarea element cols/rows are ignored if field-sizing:content Issue: whatwg#6807 Issue: w3c/csswg-drafts#7542
See w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: I21226d8216ae42254d4dc50d17e173884afd4e87 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4918050 Auto-Submit: Kent Tamura <tkent@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1206161}
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This covers: * input element as a text entry widget: size attribute is ignored if field-sizing: content is set. * input element with number state * input element as a file upload control (optional) * select element: size attribute is used only for dropdown/listbox switching if field-sizing: content is set * textarea element: cols/rows are ignored if field-sizing: content is set This also stops applying "presentational hints" and "user-agent-level style rule" for width and height properties in order to match to major browser behaviors. Fixes #6807. See also w3c/csswg-drafts#7542.
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.
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
The text was updated successfully, but these errors were encountered: