How to set Autofocus for loginPage

Product: PowerShell Universal
Version: 2.7.2

Hey everyone,

I’ve customized a forms login page. Everything works great, but how do I set autofocus to the Username text box?

Before adding page links with New-PSULoginPageLink, I’d have to press Tab once to have the focus on the Username textbox. Not what I’d like, but pressing Tab once is not too bad. Once I added the PSULoginPageLinks I now have to press Tab 4 times to reach the Username textbox.

I’ve tried using Select-UDElement at the bottom of the loginPage.ps1 file, but that doesn’t work. I’m not seeing a CCS option, and everything seems to point to doing this with HTML5, but I don’t have control over the HTML to add autofocus.

To note, I got -ID “normal_login_username” by inspecting the element in the browser. There may not actually be a UD Element with the ID “normal_login_username”.

How do I set autofocus to the Username text box, in the loginPage?

$loginPage = @{
    Image = "<URL to Logo File>"
    Title = "<Your Title>"
    PrimaryColor = "<Your Color>"
    SecondaryColor = "<Your Color>"
    PrimaryFontColor = "<Your Color>"
    SecondaryFontColor = "<Your Color>"
    HeaderFontColor = "<Your Color>"
    HeaderColor = "<Your Color>"
    CssStylesheet = "<Path to your CCS File>"
    Links = @(
    New-PSULoginPageLink -Text '<Friendly Text>' -Url '<URL to link to>'
    New-PSULoginPageLink -Text '<Friendly Text>' -Url '<URL to link to>'
        )# Links
    }# $loginPage

New-PSULoginPage @LoginPage

Select-UDElement -ID "normal_login_username"

You won’t be able to use UD commands to do this. I think we should just fix this in the product. I’ll open an issue for this.


Roger that, and thank you for opening an issue for it.

After upgrading to 2.8.0 today, I found the focus on the login page is now on the username box. Awesome!