-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix scroll container min size calculation #96305
Fix scroll container min size calculation #96305
Conversation
It would be nicer if you have attach a small video to demonstrate this bug fix. |
There is this annoying behavior with ScrollContainer where toggling scrollbar visibility will resize the content: godot.windows.editor.dev.x86_64_6WrNaIKxfv.mp4Maybe the intended behavior was to actually use the extra margin for content. |
I fail to understand what is happening here. Could you upload the scene? |
I see. The alternative would be to always reserve space for the scrollbar, even when it's not visible, unless I'm missing a better way. I don't really prefer it, I think that situations where the scrollbar is never visible will be way more that those in which the amount of elements changes just enough to show or hide it right when the user is looking at it. Looked at some web app scrollbars (fb messenger right bar, reddit "recent posts" right bar) and they behave like that - if you resize chrome vertically the scrollbar will show and hide nudging the contents, but in practice the number of elements will almost always stay static while using the page |
I run into this issue a lot in custom plugins or editors. It easily happens when the scrollable content is dynamic. You can even see it in the inspector: godot.windows.editor.dev.x86_64_W9vn0uyWdc.mp4Though I guess empty space reserved for scrollbar might look bad, so not sure what's the proper solution for that. |
Maybe use always show for cases like this where it will change often, but change it's behavior when the contents are smaller. Currently, always show will draw a huge scrollbar over the entire thing when the contents are smaller when the scrollbar. It would be better to instead draw the lower contrast background line only. This way the only thing that will change, when the contents become larger and smaller than the scroll container, is the scrollbar appearing and disappearing. |
I was just reminded that a proposal exists: |
Thanks! |
The code responsible for accounting for the
ScrollContainer
scroll bars for it's minimum size calculation was broken, so that they would always be added, even if the scrollbar wasn't shown.To test, create a scroll container and add a control with a minimum size (like a label with text). While vertical or horizontal scrollbars are on auto, try to resize the scroll container to be smaller than the contained control and observe minimum size not working properly on master