W3C home > Mailing lists > Public > www-style@w3.org > March 2012

Re: [css3-flexbox] issue with flexing with either positive or negative flexibility on all items

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 13 Mar 2012 16:26:12 -0700
Message-ID: <CAAWBYDDmWJvOC7Vy1HfbF5zHYfGkTEOaAieT4LRBtSwUb2SwAA@mail.gmail.com>
To: Alex Mogilevsky <alexmog@microsoft.com>
Cc: www-style list <www-style@w3.org>
On Mon, Mar 12, 2012 at 1:22 AM, Alex Mogilevsky <alexmog@microsoft.com> wrote:
> Current flexing algorithm choses to use either positive or negative flexibility
> for all items, which helps to ensure it will finish with any combination of
> flexibility and min/max sizes. This approach doesn't allow to optimize layout
> by shrinking a large item that is far from both its min and its max sizes, and
> growing a small item that is close to its preferred size. It may be possible to
> get a better result by calculating penalties based on actual size change,
> flexibility settings and where there calculated size is relative to
> min/max/preferred sizes.
>
> Example to consider:
>
> <flexbox>
>    <div style="flex:1 1 auto">long description of something important that is about to happen</div>
>    <button style="flex:1 1 auto">I agree</button>
> </flexbox>
>
> I don't know if this is will be really an issue. Small items can easily avoid the problem by not having a negative flexibility. I opened a bug for this anyway: https://www.w3.org/Bugs/Public/show_bug.cgi?id=16322

I think the right answer for this is what you say - just don't provide
a negative flexibility unless you're prepared to let that thing flex
negatively.  This is usually what you want anyway.

I think providing a score-based algorithm more akin to systems like
TeX's would be interesting, but should definitely be postponed to the
next level.

~TJ
Received on Tuesday, 13 March 2012 23:27:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:51 GMT