Skip to content

[css-overflow-4] display: -webkit-box and line-clamp without -webkit-box-orient: vertical #10448

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

Closed
frivoal opened this issue Jun 14, 2024 · 4 comments

Comments

@frivoal
Copy link
Collaborator

frivoal commented Jun 14, 2024

In #10324, @andreubotella asked:

What should happen when you have display: -webkit-box and some value of line-clamp, but not -webkit-box-orient: vertical? If it was -webkit-line-clamp, it would create a flexbox and the line clamping would not apply, but it's not as clear with line-clamp.

One possible behavior is that it creates a flexbox, which causes line-clamp to not apply because it is not a block container. But if the flexbox has text content, that gets blockified, so would it get clamped?

@frivoal
Copy link
Collaborator Author

frivoal commented Jun 14, 2024

My expectation would be that nothing happens, because

  • the -webkit-line-clamp compat hack needs -webkit-box-orient: vertical
  • line-clamp without the compat hack only applies to block-containers, but display: -webkit-box yields a flexbox, not a block container.

This strange behavior that requires all 3 properties only exists for compat reasons, so we should stick to that behavior

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-overflow-4] display: -webkit-box and line-clamp without -webkit-box-orient: vertical, and agreed to the following:

  • RESOLVED: no change to spec, add a note
The full IRC log of that discussion <fantasai> andreubotella: We had agreed to a compat workaround for line-clamp
<fantasai> andreubotella: if you have -webkit-box and -webkit-box-orient: vertical
<fantasai> andreubotella: then either line-clamp or -webkit-line-clamp would make it not a flex, and make it a block
<fantasai> andreubotella: and -webkit-line-clamp would apply
<fantasai> andreubotella: issue is if you have line-clamp on block containers
<fantasai> andreubotella: should display: -webkit-box + line-clamp without box-orient, should it also trigger the behavior of making it a block container?
<fantasai> andreubotella: I agree with Florian that -webkit-line-clamp only applies with -webkit-box and -webkit-box-orient:vertical
<fantasai> andreubotella: but if you have [missed]
<florian> q+
<astearns> ack florian
<fantasai> andreubotella: if you have -webkit-box and line-clamp, is -box-orient also required?
<fantasai> florian: This problem is more difficult to dscribe than to solve
<fantasai> florian: we have a weird compat hack that is required when you have -webkit-line-clamp
<fantasai> florian: and is allowed for line-clamp
<fantasai> florian: I don't think we need to generlaize
<fantasai> florian: we need to support the set for -webkit-line-clamp to work
<fantasai> florian: it needs to not work when the whole set is not there, because the Web depends o nit not triggering if any piece is missing
<fantasai> florian: if you don't have the full thing, then don't blockify the flexbox
<fantasai> florian: the non-hacky version doesn't apply to flexboxes
<fantasai> florian: not helpful, and not needed for compat, so keep it simple
<fantasai> florian: already resolved that the new line-clamp works if you have the full set of weird stuff
<fantasai> florian: but if you only have one of them, then we don't trigger the magic condition, and shouldn't
<fantasai> florian: so proposal is no change, just clarify with a note
<fantasai> astearns: proposed no change to spec, add a note mentioning the new version doesn't interact with only part of the old hack
<fantasai> RESOLVED: no change to spec, add a note

@frivoal
Copy link
Collaborator Author

frivoal commented Sep 5, 2024

Actually, the note was already there. 3e2b38d

@frivoal
Copy link
Collaborator Author

frivoal commented Sep 5, 2024

@frivoal frivoal added Tested Memory aid - issue has WPT tests and removed Needs Testcase (WPT) labels Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants