Issue scrolling to the bottom of a dynamically-resizing scrollview

Hey all, I’ve been trying to build out the UI for a chat box and have an issue that I’ve been trying to figure out and I’m not sure if it’s a bug.

In the chatbox, users can obviously send different lengths of messages, and then I get the height of that message and add it to the total content height of the scrollview (content.element.height += newChatHeight).

I’d then like to scroll to the very bottom to display the whole message. I’ve been trying to do this using scrollview.scroll.y = 1. However, the scrollview doesn’t seem to be using the updated content height and doesn’t scroll all the way to the bottom.

What makes me suspect it might be a bug is that the scrollbar handle does update to show that there is more content to display, even when the scrollview.scroll.y value is 1.

I’ve built a demo of the issue, and would appreciate any help or insights! Editor link as well, if it’s helpful.

If nothing else, I’m going to have to set the local position Y value of the content, but it seems like there should be a way to do it via the scrollview properties.
Thanks!

2 Likes

Hey @kelsey, Instead of changing scroll View value, I changed scroll bar value and it worked.
this.scrollbar.scrollbar.value = 1;
Check out the project here

2 Likes

Thanks a lot, this works great!

1 Like