HOTFIX: Fix lineedit focus (#34621)

* Test entered tree fix

* Use Opened override

* Fix keyboard focus on window open for DialogWindow

This affects Phone, Pray, Rename, and multiple other admin verbs.

* Clean up
This commit is contained in:
ShadowCommander
2025-02-06 07:14:55 -08:00
committed by GitHub
parent 6824ab4292
commit cd91effefb
2 changed files with 14 additions and 4 deletions

View File

@@ -33,8 +33,13 @@ namespace Content.Client.Labels.UI
_focused = false; _focused = false;
LabelLineEdit.Text = _label; LabelLineEdit.Text = _label;
}; };
}
// Give the editor keybard focus, since that's the only protected override void Opened()
{
base.Opened();
// Give the editor keyboard focus, since that's the only
// thing the user will want to be doing with this UI // thing the user will want to be doing with this UI
LabelLineEdit.GrabKeyboardFocus(); LabelLineEdit.GrabKeyboardFocus();
} }

View File

@@ -87,9 +87,6 @@ public sealed partial class DialogWindow : FancyWindow
Prompts.AddChild(box); Prompts.AddChild(box);
} }
// Grab keyboard focus for the first dialog entry
_promptLines[0].Item2.GrabKeyboardFocus();
OkButton.OnPressed += _ => Confirm(); OkButton.OnPressed += _ => Confirm();
CancelButton.OnPressed += _ => CancelButton.OnPressed += _ =>
@@ -110,6 +107,14 @@ public sealed partial class DialogWindow : FancyWindow
OpenCentered(); OpenCentered();
} }
protected override void Opened()
{
base.Opened();
// Grab keyboard focus for the first dialog entry
_promptLines[0].Item2.GrabKeyboardFocus();
}
private void Confirm() private void Confirm()
{ {
var results = new Dictionary<string, string>(); var results = new Dictionary<string, string>();