From 9f191b0dff157ca8e038ed26b62fb5eac8e79b57 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 1 Jul 2024 18:03:13 +0200 Subject: restore focus after submenu close --- client/menu/menu.gd | 2 ++ 1 file changed, 2 insertions(+) (limited to 'client/menu') diff --git a/client/menu/menu.gd b/client/menu/menu.gd index 5e7ba34c..2c539bd9 100644 --- a/client/menu/menu.gd +++ b/client/menu/menu.gd @@ -34,6 +34,7 @@ func menu_anim_cover(state: bool): var popup: Menu = null func submenu(path: String, instant: bool = false): + var prev_focus = Global.focused_node if popup != null: return await menu_anim_cover(true) popup = load(path).instantiate() @@ -43,6 +44,7 @@ func submenu(path: String, instant: bool = false): await submenu_close print("Submenu closed ", path) await menu_anim_cover(false) + if prev_focus != null: prev_focus.grab_focus() func exit(): await self.menu_anim_exit() -- cgit v1.2.3-70-g09d2