[csswg-drafts] [css-text-4 / css-overflow-4] Interaction of `text-wrap: balance` and `(-webkit-)line-clamp` (#9310)

jfkthame has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-text-4 / css-overflow-4] Interaction of `text-wrap: balance` and `(-webkit-)line-clamp` ==
It would be good to clarify how `text-wrap: balance` interacts with `line-clamp`.

Specifically, when both balancing and clamping are requested, in which order do these effects operate? Does the block first have its lines wrapped using the `balance` algorithm, and then clamping applied to the resulting lines (without affecting how they wrap), or is clamping applied first and then balancing applied only to the lines up to the clamp limit?

Or in simpler terms, is it expected that `(-webkit-)line-clamp` may change the line-breaks used in a block?

It seems most intuitive to me that line-clamp applies *after* the line-breaks for a block have been determined, as it is defined in terms of lines. But the test at https://wpt.live/css/css-text/white-space/text-wrap-balance-line-clamp-001.html appears to assume that `text-wrap: balance` will be applied only to the lines *up to* the `-webkit-line-clamp` limit.

[This codepen](https://codepen.io/jfkthame/pen/dywOYGe) has an example where this effect is visible. In current Chrome Canary, varying the line-clamp limit results in changes to the line-breaking throughout the paragraph. Is this the expected/desired behavior, or should it be considered a bug?

Depending on the answer to this, the text-wrap-balance-line-clamp-001.html test may need revision.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9310 using your GitHub account


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

Received on Tuesday, 5 September 2023 12:13:27 UTC