Re: [csswg-drafts] [css-ui] ? Allow <textarea> to be sized by contents. (#7542)

> 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.

Yeah that's fine, the placeholder is content. It should Just Work.

> 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 min-* of course, but it's somewhat annoying that every use of width: min-content for form elements would also require this boilerplate. I suppose min(1lh, max-content) is more palatable, but we still can't use identifiers in calc functions.

Note: you want `max()` there. The fact that you use `max()` to implement `min-*` behavior, and vice versa, will always be confusing.

Wouldn't you usually be using `height` here, so `min-height: 1lh;` is still available? That is, `textarea { form-sizing: auto; min-height: 1lh; }` would do what you want, right? Are there cases where you need to use `height` for some other value, but still want to restrict it to a minimum size expressed both in terms of content and an explicit length? (I could maybe see this, with a `height: 100%` perhaps? I think you could shuffle them around then, tho, with a `height: auto; min-height: max(1lh, 100%);`.)

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.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7542#issuecomment-1535382373 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 4 May 2023 20:38:49 UTC