ScrollView increasing size when element added

Hi!

I’ve a ScrollView where I add runtime elements. While elements are fully contained in scrollview, it has fixed size, when elements starts to be hide, scroll view height starts to increase foreach element I add. Why? It’s not for verticalbar cause actually I set it always visible.
Here what it’s happening.

I’m not understanding what the problem is here. This is pretty much how scroll views should work.

Should scroll view grow going over my top tabs?

Right, that’s what you meant. I didn’t notice that at first.

Not ever encountered this, not sure why it might happen. Would have to see how it’s styled to really pin down the reason.

I would perhaps try to give it a max height so it doesn’t grow.

This is scroll view style. I wouldn’t like giving it a max height cause I would its height grows with screen.
9681137--1380437--upload_2024-3-5_11-56-38.png

P.s. However I tried and max-height works, but it’s not what I want :confused:

Well you can set it as a percentage.

I’ll give it a try. However this bug is disappointing me XD

Thank you for your time :slight_smile:

Yeah! Percentage has same bug :smile: I have to give it a fixed value :smile:

I know it sounds silly, but, could you please try setting top and bottom margins to 0? We had similar auto sizing issues in the past for ScrollView (but we have many custom elements and default styles -also for ScrollView-, so sometimes some other styles affects each other unexpectedly); if I remember correctly, changing padding/margin values did fix it for us. ScrollView is actually constructed with many child elements, so things can be easily break.

And also, definitely check style values in the UI Toolkit Debugger to see what is causing the oversize problem.

Do you mean scroll view or child elements margins?

Try for ScrollView; but definitely use the UI Toolkit Debugger. I am just shooting in the dark.

You might want to set shrink = 0 for top continer
9696044--1383758--upload_2024-3-12_12-42-47.png

Your scroll view is trying to grow as much as possible, forcing all other elements to shrink.

thanks, that was it for me :raising_hands:t3: