UI AutomaticSize + UIPadding + Statically sized descendants produces incorrect automatic size

Reproduction Steps
This issue can be reproduced with a tree that looks like:

  • Frame AutomaticSize = XY
    • UIPadding (w/ padding set on all axes to some offset values)
    • Frame AutomaticSize = None and Size = {0, 400, 0, 100}
      • Frame AutomaticSize = None and Size = {0, 10, 0, 10} (this frame causes AutomaticSize to break)

The layout engine seems to incorrectly take into account children of statically-sized elements when determining the size of AutomaticSize elements, particularly when combined with UIPadding.

The following contains the original UI I was working with to cause this, multiple minimal repros, and two “correct” examples that are only correct because they’re missing padding or descendants.

UiPaddingAutomaticSizeBugRepro.rbxm (9.3 KB)

Note that this issue occurs even if the statically-sized child frame has its own child with a size and position of {0, 0, 0, 0}any children seem to throw off the layout engine, regardless of their size. Setting the AnchorPoint, Size, and Position of the descendant frame can have other weird effects on the AutomaticSize frame.

Expected Behavior
I expect that a statically-sized frame inside of an AutomaticSize+UIPadding frame will be treated the same regardless of its descendants, such that the parent AutomaticSize Frame is big enough to contain the child statically-sized frame with padding.

Generally, I don’t expect an AutomaticSize Frame to take into account descendants at all, only its direct children.

Actual Behavior

Workaround
I have no good workaround for using UIPadding with AutomaticSize.

Bad workarounds, though:

  • For a single, statically-sized frame it’s possible to use a UIGridLayout alongside UIPadding, which seems to fix this.
  • A UISizeConstraint alongside the UIPadding updated by Lua to match the size of the static frame can fix this.

Issue Area: Engine
Issue Type: Display
Impact: Moderate
Frequency: Often
Date First Experienced: 2021-10-20 07:10:00 (-05:00)
Date Last Experienced: 2021-10-26 04:10:00 (-05:00)

13 Likes

This bug is so annoying, I haven’t been able to make any good UI with it always occuring. Here is another repro if anyone needs it:
Bug.rbxm (7.8 KB)

1 Like

Hey everyone! I’ve confirmed this is no longer an issue. Anyone still having trouble?

3 Likes

I still get the issue, here is something causing me trouble:
repro.rbxm (12.8 KB)
it could be the order uipadding and automatic size is done in, in the engine

please let me know if i am doing anything wrong, or i could also provide a simpler file

1 Like

Bump, TextLabels with AutomaticSize and UIPadding are still seemingly incompatible with each other.
image

1 Like