I'm getting used to Godot 4.0, and I ran into an issue where the dropdown menu from OptionButton draws behind all the other control nodes (or, at the very least, those further down the scene tree). An expanded OptionButton list drawn behind other nodes

Scene tree showing where this OptionButton node is in the tree. The warning icon next to the OptionButton node is informing me about how changing a control node's Z Index does not change its input handling order (which is not an issue here).

I changed its z-index in the inspector to be higher than the other control nodes, but this didn't help. I've also rearranged the scene tree twice: first, I rearranged it so that everything was in HBox and VBox containers instead of the GridContainer, and that didn't help; and second, to place the HBoxContainer that the OptionButton node is in inside of a CanvasLayer, and this didn't change anything either.

I have suspicions about what's going on (and a really sloppy way of fixing it in mind, involving importing this scene from Godot 3.5 which does work normally). But, I'm wondering if anyone has suggestions. Thanks!


1 Answer 1


This seems to be caused by the Window having set always_on_top to true, making it appear on top of every other window, including the PopupMenu from the OptionButton.

Thus your first solution is to not use always_on_top.

If you need always_on_top, we could hack it from script by getting the hidden PopupMenu and setting its always_on_top to match the Window:

extends OptionButton

func _ready() -> void:
    get_popup().always_on_top = get_window().always_on_top

Looking further into it took me to this issue: always_on_top breaks non-embedded popups, it seems to be related, although I'm getting the unexpected behavior even with embed_subwindows enabled in project settings.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .