# Possible FlexBox Bug?

**URL:** <https://forum.juce.com/t/possible-flexbox-bug/26302>\
**Category:** General JUCE discussion\
**Created:** [February 7, 2018, 8:12pm UTC](https://forum.juce.com/t/possible-flexbox-bug/26302 "2018-02-07T20:12:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jackmon](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jackmon](https://forum.juce.com/u/jackmon)\
**Post date:** [February 7, 2018, 8:12pm UTC](https://forum.juce.com/t/possible-flexbox-bug/26302/1 "2018-02-07T20:12:08Z")

</div>

I’m attempting to create a horizontal layout with flexBoxes and I’m pretty sure I’m seeing a bug. (Please forgive me if I’m just misunderstanding something).

My FlexBox has alignItems set to center, and yet the items don’t center along the main axis as expected. I can force them to by specifying alignSelf as center on all individual items. But I wouldn’t expect that to be necessary.

 ![FlexBoxBug](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/3/3d513ee0c910667b16c38b9fb93bf6c69c7dfd74.png)

C1, C2, C3, C4 all have width and height defined on their associated FlexItems and have flexShrink set to 0.0.

The FlexBox has the following properties:  
flexDirection = row  
flexWrap = noWrap  
alignContent = stretch  
alignItems = center  
justifyContent = center

---

<div class="post-metadata">

**Author:** ![noahdayan](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/noahdayan/32/4093_2.png) [@noahdayan](https://forum.juce.com/u/noahdayan)\
**Post date:** [February 8, 2018, 10:51am UTC](https://forum.juce.com/t/possible-flexbox-bug/26302/2 "2018-02-08T10:51:27Z")

</div>

I’m assuming you meant that they don’t align along the cross axis.

I can’t reproduce the bug in the Juce Demo however the default settings for `alignSelf` on individual `FlexItem` objects is `stretch` which using the current settings of the `FlexBox` you provided will stretch the items along the cross-axis.

Try setting the `alignContent` to center while keeping the default `alignSelf` property on the `FlexItem` objects. Does that give you the desired behaviour?

---

<div class="post-metadata">

**Author:** ![jackmon](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jackmon](https://forum.juce.com/u/jackmon)\
**Post date:** [February 8, 2018, 4:56pm UTC](https://forum.juce.com/t/possible-flexbox-bug/26302/3 "2018-02-08T16:56:47Z")

</div>

Ah, you’re right. I missed that the default for alignSelf was stretch. Thank you! If I set it to autoAlign it does what I expect. I have to say though I would have expected the default to be autoAlign since the css property has ‘auto’ as its default.
