godotengine / godotengine/godot

OptionButton item list does not respect theme's border/margin of ScrollContainer panel style

Open
#102,121 3 comments 2 reactions 0 assignees View on GitHub
bug topic:gui
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

4.4-beta1

### System information

Windows 10 - Godot 4.4-beta1

### Issue description

When using a theme with an override on ScrollContainer with its' panel theme set to have a border (in my case 2px on all sides) and/or a content margin (in my case 5px on all sides), the size of the item list created by OptionButton is too small as it appears to assume 0px borders and margins.

It mostly correctly sizes the list, however the height is incorrect which causes a scroll bar to be visible. The scroll bar also obscures the items, which is presumably a side-effect of assuming there would be no scroll bar.

https://i.imgur.com/jiC8Kfx.png

### Steps to reproduce

1. Create a new 2D Scene and set the root node type to Control with Full Rect anchors
2. Create a style that overrides ScrollContainer
3. Set ScrollContainer panel theme to a new StyleBoxFlat
4. Set the new StyleBoxFlat border and/or margin values to be more than 0
5. Apply the theme to the Control root node

### Minimal reproduction project (MRP)

[Option Button Test.zip](https://github.com/user-attachments/files/18573819/Option.Button.Test.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.