Re: [csswg-drafts] [css-sizing] Rethinking how to prevent overflow in a container with an explicit aspect ratio (#3268)

The CSS Working Group just discussed `[css-sizing] Rethinking how to prevent overflow in a container with an explicit aspect ratio`, and agreed to the following:

* `RESOLVED: use min-height: auto to solve problem of content overflowing aspect-ratio`

<details><summary>The full IRC log of that discussion</summary>
&lt;astearns> topic: [css-sizing] Rethinking how to prevent overflow in a container with an explicit aspect ratio<br>
&lt;astearns> github: https://github.com/w3c/csswg-drafts/issues/3268<br>
&lt;fremy> fantasai: so jensimmons_ filed this issue about how we are going to handle non-replaced element aspect ratio<br>
&lt;fremy> fantasai: it's possible that the content might overflow the element<br>
&lt;fremy> fantasai: so do we want to make sure the aspect ratio is a rigid ratio, or just a minimum ratio<br>
&lt;fremy> fantasai: there are multiple ways to do this<br>
&lt;fremy> fantasai: one would be to take advantage of min-height: auto then use min-content or aspect ratio, but otherwise use only the aspect ratio<br>
&lt;dbaron> Was having min/max-aspect-ratio one of the options?<br>
&lt;fremy> jensimmons_: we talked about it before, if you have paragraph with a couple of words an an aspect ratio<br>
&lt;fremy> jensimmons_: if the ratio allows for breathing room at the bottom, it's fine<br>
&lt;fremy> jensimmons_: but if it's smaller because the paragraph has lots of words, then it's overflowing<br>
&lt;fremy> jensimmons_: so we thought maybe the default behavior would to take min-content into account<br>
&lt;fantasai> Florian's proposal to use min-height: https://github.com/w3c/csswg-drafts/issues/3268#issuecomment-437731901<br>
&lt;fremy> fantasai: so, could we resolve and add this into the spec<br>
&lt;fremy> florian: min-content and max-content are the same in that direction<br>
&lt;fremy> florian: but if they wouldn't be in the future, which one would we want to use?<br>
&lt;fremy> florian: right now, we don't have mechanism to tweak it but it might come later<br>
&lt;fremy> dbaron: min-aspect-ratio/max-aspect-ratio<br>
&lt;fremy> dbaron: but width/height are defined in the other direction<br>
&lt;fremy> dbaron: (of priority?)<br>
&lt;fremy> fantasai: yes, but you can apply the ratio in both directions, because we do it in the direction that is auto<br>
&lt;fremy> dbaron: but if you worry about sizing of height, I guess by then the width has been set<br>
&lt;fantasai> jensimmons_: I don't know what min-aspect-ratio or max-aspect-ratio would mean, and I don't think we need a three-part aspect ratio system<br>
&lt;fremy> dbaron: the idea I was thinking is that you might want an aspect ratio, but that could be taller or wider, you could use min-aspect-ratio<br>
&lt;fremy> dbaron: well, ok, maybe I got this backwards<br>
&lt;fremy> dbaron: so it's fair to say that min and max might be confusing in this case<br>
&lt;fremy> dbaron: but it's more expressive<br>
&lt;fremy> jensimmons_: I don't think there is a use case for max-aspect ratio<br>
&lt;fantasai> jensimmons_: I think the desired behavior is that you set an aspect ratio, and if there's more content it grows bigger... or it overflows<br>
&lt;fremy> jensimmons_: you want the aspect ratio to either be strict<br>
&lt;fantasai> jensimmons_: It's not a minimum aspect ratio, it's the desired aspect ratio unless it gets overflowed<br>
&lt;fremy> jensimmons_: or allow for the box to grow<br>
&lt;rachelandrew> q+<br>
&lt;fantasai> jensimmons_: I don't know what the use case is for a maximum aspect ratio<br>
&lt;fantasai> jensimmons_: or a range of aspect ratios<br>
&lt;fantasai> jensimmons_: From authoring / film industry... doesn't make sense<br>
&lt;fantasai> jensimmons_: You want a particular target, or you let it  slide because it's not a good idea (overflow)<br>
&lt;fantasai> jensimmons_: I'd rather do the 1st proposal not the 2nd, to summarize<br>
&lt;Rossen> q?<br>
&lt;florian> q+<br>
&lt;xfq> ack ra<br>
&lt;fremy> rachelandrew: maybe there are a couple of use cases that this doesn't solve<br>
&lt;fremy> rachelandrew: can we make a proposal statement, and try to get this out?<br>
&lt;fantasai> rachelandrew: Trying to think of a use case this doesn't solve. Would like something written up with an example, say to authors, "this is wha we're thinking of doing, behaves like this. Can you think of any use case it doesn't solve?"<br>
&lt;fremy> ScribeNick: fantasai<br>
&lt;fantasai> rachelandrew: Pple are doing this all over the web, so have an idea of what they need<br>
&lt;fantasai> rachelandrew: We could get htis out there and see if it'll solve the problems<br>
&lt;xfq> ack fl<br>
&lt;jensimmons_> q?<br>
&lt;fantasai> florian: agree with jensimmons_<br>
&lt;fantasai> florian: The thing you brought up, dbaron, is whta the proposal is trying to solve<br>
&lt;fantasai> florian: Want to grow by default if too much content<br>
&lt;fantasai> florian: min/max-aspect ratio is too confusing<br>
&lt;fantasai> florian: and the first one gets most of what you want, and you can enforce strictly if you need<br>
&lt;fantasai> jensimmons_: 2 use cases most common<br>
&lt;fantasai> jensimmons_: 1 - video or empty decorative box<br>
&lt;fantasai> jensimmons_: not a video element video, but iframe or object or something<br>
&lt;fantasai> jensimmons_: other use case is teaser cards or something like that<br>
&lt;fantasai> jensimmons_: Maybe you want them all squares<br>
&lt;fantasai> jensimmons_: but you don't want them to consrain height, because want to allow overflow<br>
&lt;bkardell_> q+<br>
&lt;fantasai> jensimmons_: Is anyone imagining a different class of use case<br>
&lt;fantasai> q+<br>
&lt;xfq> ack bk<br>
&lt;fantasai> bkardell_: I'm hesitant to even bring this up, because not sure it fits in conversation, but not that long ago I worked on a project that was CMS-oriented<br>
&lt;fantasai> bkardell_: It was very open to what authors could provide<br>
&lt;fantasai> bkardell_: There were maybe 2-3 different kinds of images with their own aspect ratios<br>
&lt;fantasai> bkardell_: there was some negotiation<br>
&lt;fantasai> bkardell_: wanting to deal with the actual spect ratio was the issue we had there<br>
&lt;fantasai> bkardell_: but seems the opposite of what jen's talking about<br>
&lt;fantasai> bkardell_: might not be relevant...<br>
&lt;fantasai> astearns: We're talking here to add an aspect ratio tonon-replaced elements<br>
&lt;fantasai> astearns: so behavior needs to be specified for when content can't match aspect ratio that was specified<br>
&lt;fantasai> astearns: images always can<br>
&lt;fantasai> jensimmons_: Images come in when you use object-fit: cover or contain<br>
&lt;fantasai> jensimmons_: and want ot give a particular aspect ratio<br>
&lt;fantasai> jensimmons_: but that's about interaction of explicit and implicit aspect ratios<br>
&lt;xfq> ack fan<br>
&lt;fremy> fantasai: one of the benfits of the min-height auto solution<br>
&lt;fremy> fantasai: is that we can easily turn off the grow behavior<br>
&lt;fremy> fantasai: for example when we have scrolling in place<br>
&lt;dholbert> q+<br>
&lt;fremy> fantasai: which I think is what we want by default<br>
&lt;fantasai> fantasai: this is what min-height: auto is for<br>
&lt;astearns> ack dholbert<br>
&lt;fantasai> dholbert: One thing to think about is the thing with aspect ratio is not itself scrollable<br>
&lt;fantasai> dholbert: but it has a scrollable child<br>
&lt;fantasai> dholbert: min-height: auto means be as tall as the thing inside the scrollable thing<br>
&lt;florian> q+<br>
&lt;fantasai> dholbert: because the scrollble content is one level belo<br>
&lt;fantasai> dholbert: fixable by setting min-height: 0<br>
&lt;fantasai> dholbert: but might be worth thinking about<br>
&lt;fantasai> q+<br>
&lt;fremy> fantasai: actually, that spec has a simple solution<br>
&lt;fremy> fantasai: the question is whether this is web-compatible<br>
&lt;fremy> fantasai: so we need to implement this and see in a canary build if that works<br>
&lt;fremy> cbiesinger: it's in the backlog, but only for width<br>
&lt;fremy> fantasai: well, you said you could only do this for width, but eventually we would want to try both<br>
&lt;xfq> ack florian, fantasai<br>
&lt;fremy> fantasai: but width is a good start<br>
&lt;fantasai> florian: Maybe this is one place where in the block axis we have a difference between min-content/max-content... maybe not<br>
&lt;xfq> q?<br>
&lt;xfq> ack florian<br>
&lt;xfq> ack fantasai<br>
&lt;fantasai> florian: max-content you expand all the ontent. min-content you don't...<br>
&lt;fantasai> Rossen: That's super weird<br>
&lt;florian> q-<br>
&lt;fantasai> q-<br>
&lt;fantasai> Rossen: I think it is super weird. It is also a beahvior that is desired.<br>
&lt;fantasai> Rossen: If we going to introduce something like this, let's not re-introduce max-width or something<br>
&lt;fantasai> Rossen: let's add another propert<br>
&lt;fantasai> florian: I did not mean the max-width prperty<br>
&lt;fantasai> florian: I meant themax-content keyword<br>
&lt;fantasai> florian: min-height: auto grows you beyond the auto height<br>
&lt;fantasai> florian: If you specified min-height: max-content you would grow and min-height: min-content you would not<br>
&lt;fantasai> jensimmons_: We started there, but decided to use auto instead<br>
&lt;fantasai> jensimmons_: You'd get the same result<br>
&lt;fantasai> florian: Thing I hadn't considered is what dholbert brought up, when it's the children of the thing with an aspect ratio that are scrollable<br>
&lt;fantasai> florian: Do you want control over that?<br>
&lt;fantasai> florian: ...<br>
&lt;fantasai> jensimmons_: My expectation is that if you assign an aspect ratio to a box and inside there's crollable contentn, then your desire is to keep that content at that spect ratio<br>
&lt;fantasai> jensimmons_: and then the content scrolls<br>
&lt;fantasai> jensimmons_: that would be awesome<br>
&lt;fantasai> jensimmons_: The fact that children is scrolling, want the container to grow?<br>
&lt;fremy> +1 to what fantasai said<br>
&lt;fremy> fantasai: I think this is one of the big mistake we made, and I really want this fixed<br>
&lt;fremy> fantasai: I am afraid of the webcompat<br>
&lt;fremy> fantasai: so I can't make this change just by myself<br>
&lt;Rossen> q?<br>
&lt;fremy> fantasai: but authors shouldn't have to set weird height:0 etc hacks to work around this<br>
&lt;fremy> astearns: but this is orthogonal to this issue, right?<br>
&lt;fremy> fantasai: yes<br>
&lt;tantek> +1 on fantasai's proposal from an authoring perspective. I hope we can do it and maintain compat!<br>
&lt;fantasai> proposal is to use min-height: auto to solve the problem of having the box grow past its aspect-ratio in order to accommodate content that would otherwise overflow<br>
&lt;fantasai> jensimmons_: [gives an example]<br>
&lt;fantasai> jensimmons_: If have 400px wide box with 1:1 aspect ratio and content is 700px heigh<br>
&lt;fantasai> jensimmons_: min-height: auto computes to 700px, therefore wins over the height calculated by aspect ratio<br>
&lt;fantasai> jensimmons_: author can set min-height: 0 to get that content ignored in the sizing<br>
&lt;fremy> dholbert: for both axes?<br>
&lt;fremy> fantasai: I think so, but not if both are auto<br>
&lt;fremy> dholbert: (example was about a very long word you can't break)<br>
&lt;xfq> q+ AmeliaBR<br>
&lt;fantasai> AmeliaBR: object-fit?<br>
&lt;xfq> ack AmeliaBR<br>
&lt;fantasai> fantasai: this is about non-replaced elements, doesn't apply<br>
&lt;fantasai> astearns: objectiosn to proposed resolution?<br>
&lt;fantasai> RESOLVED: use min-height: auto to solve problem of content overflowing aspect-ratio<br>
&lt;fantasai> https://github.com/w3c/csswg-drafts/issues/1865<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3268#issuecomment-467970982 using your GitHub account

Received on Wednesday, 27 February 2019 18:13:54 UTC