When making some changes and improvements to Shikai Theme, I wanted to implement an autofocus feature for the password prompt, which would focus the prompt when the theme gets loaded, so the user does not have to click on it manually. In theory, this is something simple to do and, consequently, I achieved it by adding the following code to get triggered on the prompt load event:
The problem is this only seems to work when running the greeter on a single monitor or inside a session with and without the -d flag.
What I could deduct from some tests I did is that when using more than one monitor each monitor behaves like a separate tab/window and only one of them has 'focus'. As the .focus() function only gives focus to the element if the tab is active, the element does not get focused. Particularly, in my situation, the secondary screen, that only shows a wallpaper, appears to be the one focused, thus preventing the primary screen, that has the prompt, to get focused/active and the .focus() function to have any effect. My mouse always appears on the secondary screen and sometimes when I click on the primary screen the .focus() function seems to take effect as the prompt gets focused.
Possible solutions
This is a list of possible solutions I came with:
Set the primary screen to get focused/active by default
Add a configuration option to select which screen gets focus on greeter start
Add some method in the API to change focus from one screen to another
The list of solutions is based on the assumption that all of my deductions are correct and the greeter does work like that internally. In case I'm wrong feel free to correct me :)
Environment
Description of feature
When making some changes and improvements to Shikai Theme, I wanted to implement an autofocus feature for the password prompt, which would focus the prompt when the theme gets loaded, so the user does not have to click on it manually. In theory, this is something simple to do and, consequently, I achieved it by adding the following code to get triggered on the prompt load event:
setTimeout(() => {document.getElementById("password").focus();}, 250);
The problem is this only seems to work when running the greeter on a single monitor or inside a session with and without the -d flag.
What I could deduct from some tests I did is that when using more than one monitor each monitor behaves like a separate tab/window and only one of them has 'focus'. As the .focus() function only gives focus to the element if the tab is active, the element does not get focused. Particularly, in my situation, the secondary screen, that only shows a wallpaper, appears to be the one focused, thus preventing the primary screen, that has the prompt, to get focused/active and the .focus() function to have any effect. My mouse always appears on the secondary screen and sometimes when I click on the primary screen the .focus() function seems to take effect as the prompt gets focused.
Possible solutions
This is a list of possible solutions I came with:
The list of solutions is based on the assumption that all of my deductions are correct and the greeter does work like that internally. In case I'm wrong feel free to correct me :)
Thanks for making the greeter