I've been reading about inconsistency of flexbox across browsers lately and I ended focusing on this particular example: making buttons flex containers.
It is a long known bug and there are some workarounds:
- https://github.com/philipwalton/flexbugs#flexbug-9
- Flexbox not working on button or fieldset elements
So, based on those links ^^ I expected to find some weird behaviours.
Example 1:
.one {
  height: 100px;
  width: 200px;
  border: 1px solid black;
}
.two {
  height: 100%;
  width: 100%;
  background: red;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.three {
  flex-grow: 1;
  background: yellow;
}<div class="one">
 <button class="two">
  <span class="three">
   Hello
  </span>
 </button>
</div>What I don't understand about example 1 is that if you remove align-items: stretch; the yellow span doesn't stretch by default across the cross axis (here horizontal axis) on Chrome and Safari 
but does on Firefox.
Example 2:
.one {
  height: 100px;
  width: 200px;
  border: 1px solid black;
}
.two {
  height: 100%;
  width: 100%;
  background: red;
  display: flex;
  flex-direction: column;
}
.three {
  flex-grow: 1;
  background: yellow;
}<div class="one">
 <button class="two">
  <span class="three">
   Hello
  </span>
 </button>
</div>As expected, example 2 doesn't stretch the yellow button horizontally on Chrome and Safari but does on Firefox.
According to the W3C standards https://www.w3.org/TR/css-align-3/#align-items-property
the default value for align-items is stretch (or normal which, I think, does more of less the same thing in this context) for all elements.
What I found is that the default value of align-items for buttons in Safari and Chrome is flex-start. For Firefox, it is normal.
My question is: why don't Safari and Chrome respect the standard for the default value of align-items ?
Since they both share the value flex-start it might be a webkit thing but still doesn't explain why.
User agent style for buttons in Chrome
PS1: I am using
- Chrome 79.0.3945.79
- Safari 12.1.1
- Firefox 70.0.1
PS2: FYI if I make it a flex container row even applying align-items: stretch; won't make a difference, still doesn't stretch across the cross axis but I would think that's because buttons are bad flex-containers: https://jsfiddle.net/jimousse/9by4zg32/1/
