iron-flex-layout icon indicating copy to clipboard operation
iron-flex-layout copied to clipboard

Why `flex-1` factor has a `flex-basis` attribute and other factors don't ?

Open alemarre opened this issue 9 years ago • 6 comments

Hello,

I just spent some time wondering why my different flex boxes with a flex-2 class weren't of the same height in a vertical layout (height was varying depending on the content). I had another working example with boxes using flex class with "fixed" heights.

I found on the net that the grow attribute was related to a flex-basis factor, and to assure elements to be the exact same height/width, this flex-basis attribute had to be 0. Then I noticed that this factor was set to ~0 only on the flex-1class.

Is this behavior has been developed in a purpose ?

Thanks for your help

alemarre avatar Mar 22 '16 17:03 alemarre

This might be related to IE10 compatibility: https://github.com/Polymer/polymer/issues/1097 But the rendering is somewhat buggy when using vertical layout.

timeu avatar Apr 04 '16 22:04 timeu

Oof, we should investigate if this is still needed. It was originally there because IE10's flexbox is really messed up, and needs the weird flex basis; I think we should either add it to all the flex factors, or remove it from flex-1, but some consistency is needed.

notwaldorf avatar Apr 08 '16 19:04 notwaldorf

cc/ @danbeam @mgiuffrida

Same question for the "flex" class. Pasting from https://bugs.chromium.org/p/chromium/issues/detail?id=635633#c11

In iron-flex-layout.html the "flex" class simply specifies "flex: 1", see here. On the other hand, in the new iron-flex-layout-classes.html the "flex" class also specifies an odd flex-basis value of 0.000000001px, which breaks some of our UIs, see here.

@notwaldorf: Is there a reason for the flex-basis to exist? This is effectively blocking the transition from the deprecated iron-flex-layout.html to iron-flex-layout-classes.html for Chrome.

freshp86 avatar Apr 27 '17 20:04 freshp86

TBH, I think it was an IE10 quirk. I think we can definitely fix this in the 2.0-preview branch, but I have soooome IE10 worries about fixing it on master. :/

notwaldorf avatar Apr 28 '17 02:04 notwaldorf

(but if we can test that changing that flex basis doesn't break the tests in IE10, that's probably sufficient)

notwaldorf avatar Apr 28 '17 02:04 notwaldorf

@notwaldorf could we get away with using the weird basis value only with -ms prefixes? Or maybe -ms-flex-preferred-size could have the same effect as flex-basis (can't find documentation for it)

mgiuffrida avatar May 03 '17 07:05 mgiuffrida