diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs index f54a5e899f..0d8c6a4d4f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoLogic.cs @@ -81,6 +81,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (tabContainer != null) tabContainer.IsVisible = () => true; + var chatPanel = widget.Get(panels[IngameInfoPanel.Chat].Panel); + for (var i = 0; i < numTabs; i++) { var type = visiblePanels[i]; @@ -90,7 +92,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (tabButton != null) { tabButton.Text = info.Label; - tabButton.OnClick = () => activePanel = type; + tabButton.OnClick = () => + { + if (activePanel == IngameInfoPanel.Chat) + LeaveChatPanel(chatPanel); + + activePanel = type; + }; tabButton.IsHighlighted = () => activePanel == type; } @@ -160,5 +168,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic Game.LoadWidget(world, "CHAT_CONTAINER", chatPanelContainer, new WidgetArgs() { { "isMenuChat", true } }); } + + static void LeaveChatPanel(Widget chatPanelContainer) + { + chatPanelContainer.Get("CHAT_TEXTFIELD").YieldKeyboardFocus(); + } } }