-
Notifications
You must be signed in to change notification settings - Fork 719
[css-inline-3] text-box-trim accumulation #5426
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
I was just looking into how to solve text-box-trim on the first/last blocks in a section or article, and having the possibility to set <section>
<h2>A titleh2>
<p>A paragraphp>
<p>Another paragraphp>
section> section {
text-box-trim: both;
text-box-edge: auto;
}
h2, p {
text-box-trim: auto;
} Would |
The CSS Working Group just discussed The full IRC log of that discussion |
@johannesodland Yes. This is actually the currently-specced behavior, but there's no conflict resolution specified if both of them specify a text-box-trim value. :) |
I propose that we go with "take metric from closest that asks for trimming" among the three listed from the meeting notes. I don't think we need any new keyword values. More precise wording: a line is trimmed according to the Note: we don't need this spec language for Note: This is different than inheritance, because it only applies to the first line of any descendant of the ancestor, not to all first lines of different paragraphs. The line referred to by |
Taking the innermost metric probably is pretty easy to understand. I'm just worried we'll have a problem like we do with collapsed table borders, where the obvious thing was to have the innermost (“most specific“) win, but it actually works out to not do the right thing on most tables. :] (The example is, btw: same-width solid borders applied to the table, row group, and cells, with the cells being gray and the table/row group being black. Similar to this. You end up with all-gray borders, which isn't want you want: it's actually the outer elements that you want to win here, because the borders that coincide with them are the “most special”.) |
My suggestion is to resolve on this behavior in the spec because it's easy enough to understand, prototype it in a browser engine, and then ask developers to try it and gather their feedback. If they find problems we can reconsider the semantics. |
I think that while tentatively implementing "the right thing" even if we're not sure if it's going to be web-compatible and reverting if it isn't can often be a good idea, shipping a thing which may not be the best approach and changing later it if people don't like it is a lot dicier, as we may be trapped by compat by then, even if we do conclude that the alternative behavior would have been better. Now, if it's about implementing without shipping in order to let people experiment with prototypes, sure. But then I don't think it needs to be in the spec. |
The CSS Working Group just discussed
The full IRC log of that discussion |
This patch adds a test for when the element to trim has different `text-box-edge` value from the `text-box-edge` value of the element that has `text-box-trim`. Discussed and resolved at: w3c/csswg-drafts#5426 Bug: 40254880 Change-Id: I5685fbaebddb8c7429b3b041c5fe0f88b982fc3d
This patch adds a test for when the element to trim has different `text-box-edge` value from the `text-box-edge` value of the element that has `text-box-trim`. Discussed and resolved at: w3c/csswg-drafts#5426 Bug: 40254880 Change-Id: I5685fbaebddb8c7429b3b041c5fe0f88b982fc3d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5547563 Auto-Submit: Koji IshiiReviewed-by: Kent Tamura Commit-Queue: Kent Tamura Cr-Commit-Position: refs/heads/main@{#1303166}
This patch adds a test for when the element to trim has different `text-box-edge` value from the `text-box-edge` value of the element that has `text-box-trim`. Discussed and resolved at: w3c/csswg-drafts#5426 Bug: 40254880 Change-Id: I5685fbaebddb8c7429b3b041c5fe0f88b982fc3d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5547563 Auto-Submit: Koji IshiiReviewed-by: Kent Tamura Commit-Queue: Kent Tamura Cr-Commit-Position: refs/heads/main@{#1303166}
This patch adds a test for when the element to trim has different `text-box-edge` value from the `text-box-edge` value of the element that has `text-box-trim`. Discussed and resolved at: w3c/csswg-drafts#5426 Bug: 40254880 Change-Id: I5685fbaebddb8c7429b3b041c5fe0f88b982fc3d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5547563 Auto-Submit: Koji IshiiReviewed-by: Kent Tamura Commit-Queue: Kent Tamura Cr-Commit-Position: refs/heads/main@{#1303166}
I am not sure if I understood the discussion result correctly. When nesting different elements with different line-heights, the height of the largest line-height is used for the entire group. For me as developer it would be most intuitive if text-box-trim would behave in a similar way. Here are two examples and in both examples the largest font-size should be used for the trim calculation:
For the same font size couldn't we do just trim the minimum? for example |
Thank you @jantimon for the great feedback. Let me explain my understanding of the resolution. The #8829 resolved to split the line-box-affecting aspects of <div style="text-box-trim: both; text-box-edge: text">
<div style="text-box-edge: leading">
<div style="text-box-edge: cap text">FIRSTdiv>
<div>MIDDLEdiv>
<div style="text-box-edge: text alphabetic">LASTdiv>
div>
div> Since the resolution is "innermost", the top of the "FIRST" should be trimmed at the The split in #8829 made applying When we start discussing @fantasai Please correct me if any. |
thanks @kojiishi for your quick response - so it is not in that case "innermost" makes perfect sense for many different scenarios e.g. optical vertical text centering: ![]() |
…stonly Automatic update from web-platform-tests [text-box-trim] Test accumulations This patch adds a test for when the element to trim has different `text-box-edge` value from the `text-box-edge` value of the element that has `text-box-trim`. Discussed and resolved at: w3c/csswg-drafts#5426 Bug: 40254880 Change-Id: I5685fbaebddb8c7429b3b041c5fe0f88b982fc3d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5547563 Auto-Submit: Koji IshiiReviewed-by: Kent Tamura Commit-Queue: Kent Tamura Cr-Commit-Position: refs/heads/main@{#1303166} -- wpt-commits: 5e6793faa62943090d88eca7fa6390219f06832d wpt-pr: 46340
…stonly Automatic update from web-platform-tests [text-box-trim] Test accumulations This patch adds a test for when the element to trim has different `text-box-edge` value from the `text-box-edge` value of the element that has `text-box-trim`. Discussed and resolved at: w3c/csswg-drafts#5426 Bug: 40254880 Change-Id: I5685fbaebddb8c7429b3b041c5fe0f88b982fc3d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5547563 Auto-Submit: Koji IshiiReviewed-by: Kent Tamura Commit-Queue: Kent Tamura Cr-Commit-Position: refs/heads/main@{#1303166} -- wpt-commits: 5e6793faa62943090d88eca7fa6390219f06832d wpt-pr: 46340
Hi, I'm not sure if this is related to this issue, but I'm facing a strange output and I'm not able to understand if this is expected or not (and if it is, this is extremely unintuitive): https://codepen.io/bakura10/pen/GgKMvqR I'm applying the text-box on the parent, so the container now no longer wrap the content. I've tried to set the text-box on the button, but this does not seem to work. ![]() Ideally, this is the end result I would like: ![]() I can of course use trim-start instead of trim-both, but I don't control the content, so the last element might be something different than a button. |
@bakura10 IIUC it's the expected behavior as per the current spec, works the same in Blink and WebKit. As you pointed out, you'll need to use But it's also true that the WG may have missed some use cases. I think filing a new issue is helpful to get attentions. |
We allow ancestors to affect leading trimming on descendants, so that common cases like
will work for authors. But we don't specify what happens if various ancestors have different values for
leading-trim
.Maybe we should do something similar to
break-before
and switch to an auto/no/yes model where auto does whatever the ancestor says and otherwise the innermost value wins?The text was updated successfully, but these errors were encountered: