Make text fields yield keyboard focus on "Esc" in a consistent way
- search fields clear the input and yield if empty - chat field and actor edit field yield without clearing
This commit is contained in:
committed by
abcdefg30
parent
df8295fa2c
commit
64e76e1a90
@@ -46,8 +46,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
SearchTextField = widget.Get<TextFieldWidget>("SEARCH_TEXTFIELD");
|
||||
SearchTextField.OnEscKey = _ =>
|
||||
{
|
||||
SearchTextField.Text = "";
|
||||
SearchTextField.YieldKeyboardFocus();
|
||||
if (string.IsNullOrEmpty(SearchTextField.Text))
|
||||
SearchTextField.YieldKeyboardFocus();
|
||||
else
|
||||
{
|
||||
SearchTextField.Text = "";
|
||||
SearchTextField.OnTextEdited();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user