W3C home > Mailing lists > Public > www-style@w3.org > August 2014

Re: [css-flexbox] max-content sizing of flex containers is wrong

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 18 Aug 2014 17:25:13 -0700
Message-ID: <CAAWBYDDT_4PL0cjS6610Qh36QM2DUpd5oEFhzX2MkxOZjmGm3A@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: "www-style@w3.org" <www-style@w3.org>
On Mon, Aug 18, 2014 at 5:20 PM, fantasai <fantasai.lists@inkedblade.net> wrote:
> Hi!
> Just noticed that the max-content sizing rules for flexboxes is wrong.
> It takes the sum of the max-content contributions of its items. But
> actually, it needs to account for flex factors, the same way the grid
> layout algorithm does.
>
> Example:
>   <flexbox>
>     <item>foo foo foo</item>
>     <item>foo</item>
>   </flexbox>
>
>   item { flex: 1; }
>
> Suppose "foo" is approximately 3em wide.
> The max-content contribution of the first item is ~9em.
> The max-content contribution of the second item is ~3em.
> The max-content size of the flexbox is therefore defined to be 12em.
>
> Since the flex basis is zero and flex is one, after flex layout
> each item is 6em wide. The contents of the first item wrap into
> the 6em, and max-content's definition fails, 'cuz wrapping.

In particular, grid handles this correctly, by iterating through all
the tracks that are flexible and finding the largest size it needs to
assign to an fr to meet the constraints of all the items placed into
flexible tracks.

~TJ
Received on Tuesday, 19 August 2014 00:26:04 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 19 August 2014 00:26:05 UTC