W3C home > Mailing lists > Public > www-style@w3.org > February 2015

Re: [css-flexbox] min-height on flex items that have an intrinsic aspect ratio

From: Daniel Holbert <dholbert@mozilla.com>
Date: Tue, 24 Feb 2015 11:16:41 -0800
To: fantasai <fantasai.lists@inkedblade.net>, "Tab Atkins Jr." <jackalmage@gmail.com>, Greg Whitworth <gwhit@microsoft.com>
Cc: "www-style@w3.org" <www-style@w3.org>
message-id: <54ECCE19.7020501@mozilla.com>
On 08/19/2014 01:43 PM, fantasai wrote:
>> Circling back here, we think we fixed this back in May, by adding the
>> following lines to the "min-width/height: auto" requirements:
>>
>> # <li>if the item has no intrinsic aspect ratio, its <a>min-content
>> size</a>,
>> # <li>if the item has an intrinsic aspect ratio,
>> #   the width (height) calculated from
>> #   the aspect ratio and any definite size constraints in the opposite
>> dimension
>>
>> Does this work? We think it does.
> 
> We've gone ahead and expanded this out to be more comprehensive. The
> new text is at
>   http://dev.w3.org/csswg/css-flexbox/#min-size-auto
> 
> (Note, we also incorporated handling of 'width' and 'height' to avoid
> surprises when the author specifies a size smaller than the min-content
> size.)

Hi fantasai/tab/Greg,

I've just realized that the "expanding"/"more comprehensive" rewrite in August 2014 here actually changed behavior in a pretty substantial way.

The changeset hinted at in this ^ message that I'm replying to was:
  https://hg.csswg.org/drafts/rev/9b745a07d529

Importantly:
 - *Before* this commit, it was clear that min-content size is *ignored* when resolving "min-width:auto", for flex items that have an intrinsic aspect ratio.
 - But after this commit, min-content size is *needed* & used when resolving "min-width:auto" for these flex items. (It's just clamped by transferred min/max properties in the other direction, and if there happens to also be a definite cross-size property, that can push the min-size lower.)

So in a case with e.g. an <img> with min-width:auto & no cross-size properties, the spec now requires that we now clamp it to its min-content main size, when it previously did not.

Example:  http://jsfiddle.net/410jorp8/1/
(partially stolen from a codepen in a different thread here)
The min-content width of the image there is 300px. But Firefox allows it to be smaller than that (using its flex-basis of "50px", & not clamping to the min-content size). This is correct per the pre-August spec-language, but it's incorrect per the current spec language.

I prefer the pre-August behavior on this point, because min-content sizes aren't really a useful lower-bound for flex items with aspect ratios. These flex items *can* shrink (honoring their intrinsic aspect ratio) below their min-content size, without overflowing.

Was this behavior-change intentional? (making min-width:auto depend on min-content size, for items w/ intrinsic aspect ratios)

Thanks,
~Daniel
Received on Tuesday, 24 February 2015 19:17:15 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC