ScrollingFrames in some scenarios do not *actually* update CanvasSize when setting it in an AbsoluteContentSize Changed handler of Layout objects inside of the ScrollingFrame until the ScrollingFrame redraws

  • Describe the bug. Describe what is happening when the bug occurs. Describe what you would normally expect to occur.

When updating the CanvasSize of a ScrollingFrame inside of a AbsoluteContentSize Changed handler of a (at least List/Grid) Layout object inside of that ScrollingFrame, the CanvasSize in some cases does not actually update. It does assign the new CanvasSize properly, but it does not allow scrolling to the new bounds until the ScrollingFrame redraws (I think). Setting CanvasPosition manually will also make it clamp to the old bounds.

Any sort of redrawing seems to allow scrolling to the new bounds afterwards, such as scrolling into the other direction (if the frame allows it, if the old canvassize is 0, this obviously does not work), moving the frame to another position, etc.

A dirty “fix” is to shift the frame a pixel forwards and then backwards again after setting the CanvasSize to the new value.

  • How often does the bug happen (Everytime/sometimes/rarely)? What are the steps that reproduce the bug? Please list them in very high detail. Provide simple example places that exhibit the bug and provide description of what you believe should be the behavior.

If you have a scenario where this issue occurs, it’s completely consistent. Note that this isn’t always an issue, only in certain scenarios (not sure in which scenarios exactly).

It is easier to see the issue in the follow reproduction file: scrollissuetest.rbxl (23.4 KB)
You can find reproduction steps in the “Chat” module.

  • Where does the bug happen (www, gametest, etc) Is it level-specific? Is it game specific? Please post a link to the place that exhibits the issue.

Live

  • Would a screenshot or video help describe it to someone? If so, post one.

n/a, see repro

  • For graphics bugs, it is sometimes helpful to know your system specs, especially graphics card.

OS: Win 10

  • When did the bug start happening? If we can tie it to a specific release that helps us figure out what we broke.

Since the new UI system got deployed (some months ago) I’ve had this issue

  • Anything else that you would want to know about the bug if it were your job to find and fix it.

See above

5 Likes

I’m experiencing the same issue :confused:, it’s also very annoying because tweening a frame with 2-3 scroll frames causes huge performance drops.

This was fixed by some changes I made to ScrollingFrames that I’m going to try to turn on in the next few weeks. As a stopgap fix if you can’t wait for that, you can yield a frame using Heartbeat/Stepped/RenderStepped:

ui.Messages.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
+	RunService.RenderStepped:Wait()
	local newSize = ui.Messages.UIListLayout.AbsoluteContentSize
	ui.Messages.CanvasSize = UDim2.new(0, newSize.X + 20, 0, newSize.Y + 10 + ui.Messages.AbsoluteSize.Y) -- +20 / -10 padding, + frame.abssize.y to always allow scrolling for initial messages
end)
4 Likes

This bug still exists and is driving me insane.
I’m trying to set my scrollbar to the end of the scrolling frame after it expands with AutomaticCanvasSize, but it keeps setting it to the old edge of the canvas. I do it myself in the properties window however and it updates to the real edge. Please for my sanity, take another look at this.

I am also running into this issue. Trying to scale a scollingframe so it will look good for all users, but it is always slightly too small.