Have UIListLayout set the CanvasSize property of ScrollingFrames automatically

It takes a bit more time than expected as a Roblox developer to create functional scrolling lists using the ScrollingFrame object. We do have UIListLayout - which is a godly gift, if you ask anyone - but their synergies could be improved just a little.

Since the object was released, the question on it auto-scaling to its contents has been present. Currently, the only way to resize it properly depends on doing some simple maths on a local script and applying it whenever the contents change, but that’s a bit too cumbersome.

This makes it significantly harder for UI designers to refine those lists as it requires a tad bit of scripting. Having the incorrect CanvasSize displays the scrollbar when it’s not needed (or the opposite) and makes the UX worse, taking space from other elements and the alike.

So, I propose a new property to UIListLayouts, which would be “ResizeParentToListExtents”: It would make so the GUI object which the layout is parented to changes its size dynamically as the list extends or retracts; even more useful would be if the layout could set the CanvasSize property instead if parented to a ScrollingFrame.

This wouldn’t make much of a difference from the player’s perspective but would definitely save time for us.

7 Likes

Having an entire new property to save ~4 lines of code is kind of pointless and a waste of time imo.

local frame = ScreenGui.ScrollingFrame
frame.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
    frame.CanvasSize = UDim2.new(0,0,0,frame.UIListLayout.AbsoluteContentSize.Y)
end)
9 Likes

There was actually a property that did this, and I remember it being enabled for a while. I’m not sure what happened to it.

1 Like

It’s in beta, so it wasn’t ever rolled out to the public.

1 Like