diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index e706053592f..275965b372b 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -738,10 +738,18 @@ int PopupMenu::find_item_by_accelerator(uint32_t p_accel) const { void PopupMenu::activate_item(int p_item) { - ERR_FAIL_INDEX(p_item,items.size()); ERR_FAIL_COND(items[p_item].separator); emit_signal("item_pressed",items[p_item].ID); + + //hide all parent PopupMenue's + Node *next = get_parent(); + PopupMenu *pop = next->cast_to(); + while (pop) { + pop->hide(); + next = next->get_parent(); + pop = next->cast_to(); + } hide(); }