# FlexBox changes in 6.1.4 - possible bug

**URL:** <https://forum.juce.com/t/flexbox-changes-in-6-1-4-possible-bug/49835>\
**Category:** General JUCE discussion\
**Created:** [January 25, 2022, 9:48am UTC](https://forum.juce.com/t/flexbox-changes-in-6-1-4-possible-bug/49835 "2022-01-25T09:48:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurentClerc](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@LaurentClerc](https://forum.juce.com/u/LaurentClerc)\
**Post date:** [January 25, 2022, 9:48am UTC](https://forum.juce.com/t/flexbox-changes-in-6-1-4-possible-bug/49835/1 "2022-01-25T09:48:22Z")

</div>

Hi,

One of our UI elements isn’t displaying as expected following the layout bug fixes to Flexbox and changes to FlexItem. Here’s some simple code, which if it is run using JUCE 6.1.3 or 6.1.4 will display differently:

```auto
void MainComponent::resized()
{

    auto makeItem = [] (auto& c)
    {
        return juce::FlexItem (c)
        .withHeight (100)
        .withWidth (100);
    };
    
    juce::FlexBox flexBox { juce::FlexBox::JustifyContent::spaceBetween };
    flexBox.flexDirection = juce::FlexBox::Direction::column;
    flexBox.alignContent = juce::FlexBox::AlignContent::center;
    flexBox.items = { makeItem (slider1), makeItem (slider2) };
    flexBox.performLayout (getLocalBounds());
    
}

```

 ![flexbox](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/0/0408334c195efe43ae211f66018ace3838a4d02a.png)

As you can see the rotary sliders display differently.

As workaround for the moment, adding the following line re-arranges things for me in 6.1.4

```auto
flexBox.alignItems = juce::FlexBox::AlignItems::center;

```

It looks like a bug to me. Or is this in line with what these FlexBox/FlexItem changes are trying to achieve?

---

<div class="post-metadata">

**Author:** ![ImJimmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/imjimmi/32/10843_2.png) [@ImJimmi](https://forum.juce.com/u/ImJimmi)\
**Post date:** [January 25, 2022, 9:55am UTC](https://forum.juce.com/t/flexbox-changes-in-6-1-4-possible-bug/49835/2 "2022-01-25T09:55:26Z")

</div>

See the breaking changes file:

> <https://github.com/juce-framework/JUCE/blob/9055820a30770479e30994c9a91029474cf60f7d/BREAKING-CHANGES.txt#L72>

---

<div class="post-metadata">

**Author:** ![ImJimmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/imjimmi/32/10843_2.png) [@ImJimmi](https://forum.juce.com/u/ImJimmi)\
**Post date:** [January 25, 2022, 10:00am UTC](https://forum.juce.com/t/flexbox-changes-in-6-1-4-possible-bug/49835/3 "2022-01-25T10:00:23Z")

</div>

> [@LaurentClerc](#):
>
> As workaround for the moment, adding the following line re-arranges things for me in 6.1.4
> 
> ```auto
> flexBox.alignItems = juce::FlexBox::AlignItems::center;
> 
> ```
> 
> It looks like a bug to me. Or is this in line with what these FlexBox/FlexItem changes are trying to achieve?

The previous default for flex-items’ alignment was wrong, so any layouts that relied on that default behaviour will have been affected.

The suggested fix in the breaking changes file is to set all flex-items’ alignment back to `stretch` but the solution you’ve provided to just set the single property on the parent is obviously much simpler in this case.

---

<div class="post-metadata">

**Author:** ![LaurentClerc](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@LaurentClerc](https://forum.juce.com/u/LaurentClerc)\
**Post date:** [January 25, 2022, 10:13am UTC](https://forum.juce.com/t/flexbox-changes-in-6-1-4-possible-bug/49835/4 "2022-01-25T10:13:50Z")

</div>

Ok. Makes sense thanks. I’m surprised we haven’t more UI bits look wonky at our end due to the change!
