mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Merge pull request #2861 from mRemoteNG/copilot/add-autofocus-to-password-field
[WIP] Add autofocus to password field on startup
This commit is contained in:
@@ -61,9 +61,14 @@ namespace mRemoteNG.UI.Forms
|
||||
pbLock.Image = display.ScaleImage(pbLock.Image);
|
||||
Height = tableLayoutPanel1.Height;
|
||||
|
||||
if (NewPasswordMode) return;
|
||||
if (NewPasswordMode)
|
||||
{
|
||||
txtPassword.Focus();
|
||||
return;
|
||||
}
|
||||
lblVerify.Visible = false;
|
||||
txtVerify.Visible = false;
|
||||
txtPassword.Focus();
|
||||
}
|
||||
|
||||
private void PasswordForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
|
||||
@@ -45,5 +45,15 @@ namespace mRemoteNGTests.UI.Forms
|
||||
cancelButton.PerformClick();
|
||||
Assert.That(eventFired, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PasswordFieldHasAutofocus()
|
||||
{
|
||||
// Find the password textbox control
|
||||
TextBox passwordTextBox = _passwordForm.FindControl<TextBox>("txtPassword");
|
||||
|
||||
// Verify that the password field has focus when the form is loaded
|
||||
Assert.That(passwordTextBox.Focused, Is.True, "Password field should have autofocus when form loads");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user