-
Notifications
You must be signed in to change notification settings - Fork 719
[css-ui] ? Allow #7542
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
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 |
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 |
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 |
As @bfgeek pointed out in #7542 (comment), it turns out that engines interoperably apply an implicit minimum content-box block-size of |
w3c/csswg-drafts#7542 (comment) Bug: 1447058 Change-Id: Ia87e0fde1bd47eda5102da937365be268c9f92f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4930938 Reviewed-by: Ian KilpatrickAuto-Submit: Kent Tamura Commit-Queue: Ian Kilpatrick 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 KilpatrickAuto-Submit: Kent Tamura Commit-Queue: Ian Kilpatrick 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 KilpatrickAuto-Submit: Kent Tamura Commit-Queue: Ian Kilpatrick 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 TamuraReviewed-by: Ian Kilpatrick Commit-Queue: Ian Kilpatrick 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 KilpatrickAuto-Submit: Kent Tamura Commit-Queue: Ian Kilpatrick 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 TamuraReviewed-by: Ian Kilpatrick Commit-Queue: Ian Kilpatrick 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 KilpatrickAuto-Submit: Kent Tamura Commit-Queue: Ian Kilpatrick 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 TamuraReviewed-by: Ian Kilpatrick Commit-Queue: Ian Kilpatrick 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 KilpatrickAuto-Submit: Kent Tamura Commit-Queue: Ian Kilpatrick 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 TamuraReviewed-by: Ian Kilpatrick Commit-Queue: Ian Kilpatrick 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 KilpatrickAuto-Submit: Kent Tamura Commit-Queue: Ian Kilpatrick 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 TamuraReviewed-by: Ian Kilpatrick Commit-Queue: Ian Kilpatrick 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.
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 whatwg#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
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 |
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: