Re: [csswg-drafts] [css-overflow] What counts as "immediately preceding" for `block-ellipsis`? (#10868)

I've been going back and forth about this, and I think we should mostly keep the existing definition, but make an exception allowing for the anchor of out of flow elements (floats or abspos) between the last line and the clamp point.

I think the alternatives would be:
* have the ellipsis in the last line anyway, regardless of subsequent content

    If there is content after the last line box and before the clamp point, it can get quite strange to put the ellipsis on the last line anyway: Imagine a (block) image, a table, a flexbox… having the ellipsis, then some more content, then the break, is confusing.

    More over, as currently defined, this is an inheritable property, which affects all block containers. If we don't limit ourselves to the line immediately before the clamp point, then the last line of each clamped block would get an ellipsis, which would be very wrong in case of nested blocks.
    ```
    <style>
    .clamp { line-clamp: 3; }
    </sytle>
    <div class=clamp>
      Line 1
      <div>Line 2
        <div>Line 3
          <div>Line 4</div>
        </div>
      </div>
    </div>
    ```
    would result in
    ```
    Line 1…
    Line 2…
    Line 3…
    ```
    as each line, in its own container, is the last line before the clamp point (though not immediately).
* drop content from the end until the last thing is a line.
    Seems wasteful. If there's content and room to display the content, why not show it?
* if the last thing isn't a line, and there's room for a line, add one, and put the ellipsis there.
    I think this is going to run into a ton of complexity and corner cases, without even being clear that it's always desirable.

We could also change the property to be non inherited, and to apply to clamp containers / fragmentation containers only, instead of of block containers. It's not really clear that would help with this issue though. The behavior in case of nested formatting context would have to be described differently, and would likely behave differently at least in some cases, but the fundamental problem asked in this issue would remain.

So, all in all, I suspect we want to keep the current definition, but clarify "immediately preceding" to mean something like there being no content between that last line and the clamp point, other than out of flow content.

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


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

Received on Monday, 4 November 2024 02:12:17 UTC