[csswg-drafts] [css-flexbox] automatic minimum size: what does min(250, undefined) return? (#5347)

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

== [css-flexbox] automatic minimum size: what does min(250, undefined) return? ==
```html
<div style="display: flex; width: 100px;">
  <img src="https://placekitten.com/250/250">
</div>
```

https://jsfiddle.net/dgrogan/seg19ftm/1

What is the used min-width of the `img`?

The relevant [spec text](https://drafts.csswg.org/css-flexbox/#min-size-auto)

> if the box has an aspect ratio and no specified size, its content-based minimum size is the smaller of its content size suggestion and its transferred size suggestion

says it is `min(250, undefined)` because the transferred size suggestion is undefined due to its indefinite computed cross size property:

> If the item has an intrinsic aspect ratio and its computed cross size property is definite, then the transferred size suggestion is that size (clamped by its min and max cross size properties if they are definite), converted through the aspect ratio. It is otherwise undefined.

So, what is `min(250, undefined)`? Chrome says 250 and hence the final size of the image is 250x250.

However, in the absence of any guidance, interpreting `min(250, undefined)` to be 0 would be reasonable. Under such interpretation, the image's final size would be 100x100, which is the size Gecko assigns. (I don't know that this is the reason why though. @dholbert, do you know off the top of your head? If this isn't the reason, any idea why Gecko gives 100x100?)

Should we change some of the "undefined"s in https://drafts.csswg.org/css-flexbox/#min-size-auto to "infinity"? Then min(200, infinity) would be very clear. Or, if Chrome is wrong here, we can s/undefined/0/.

(Apologies if this has been discussed or has a clear definition that I missed.)

/cc @dholbert @fantasai @cbiesinger 

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

Received on Wednesday, 22 July 2020 04:08:42 UTC