Re: [css-flexbox] Fixing a mistake with flex-grow betwen 0 and 1

Superficially, this strikes me as a reasonable change, though the
interaction with max-size in situations like what you described is
interesting...

Even in cases where rounding behavior doesn't come into play, there'd be
potential for weird discontinuities (much like the original
discontinuity at 0 that you're trying to avoid).

Consider a case with:
 <flexbox>
   <div style="flex: 0.2; width: 5px;"></div>
   <div style="flex: 0.2; width: 5px; max-width: 5px"></div>
 </flexbox>

There, we'd give 20% of the free space to the first flex item, and no
free space to the second item (due to its max-width).

Now, if we increase the "flex" on the second item to 1 (still not
affecting *its* rendering at all due to its max-width), then all of a
sudden the *first* item will snap up to occupy all of the free space,
because our flex values sum to more than 1.

I'd like to avoid that sort of discontinuity, if possible, because IIUC
this tweak is trying to prevent that sort of thing, when really it just
makes it somewhat harder to trigger. (which doesn't feel satisfying)

~Daniel


On 10/08/2013 09:31 AM, Tab Atkins Jr. wrote:
> On Tue, Oct 8, 2013 at 3:12 AM, François REMY
> <francois.remy.dev@outlook.com> wrote:
>> That being said, it still exposes browser rounding when
>> computing whether the sum is equal or greater than 1.
>> It is likely than to defeat rounding issues UA will want to
>> accept a certain "snapping-to-1" tolerance.
> 
> It'll only expose rounding when there are min/max violations - if two
> items both have "flex: .49;" and one has a small max-width, the other
> will still only fill half the free space, while if they both had
> "flex: .51;", the other would fill all the remaining space.
> 
> I'll think on this a bit more - there may be a way to hide this as well.
> 
> (If I can't, then browsers are of course free to implement "rounding"
> as they see fit - it's undefined, so having a bit of tolerance is
> totally possible.)
> 
> ~TJ
> 

Received on Wednesday, 9 October 2013 06:31:35 UTC