Topic-icon Get cursor to position on username

Active Subscriptions:

None
7 years 8 months ago #59108 by jjbong
I'm using SCLogin version 7 now (just upgraded), and it's been working fine. One improvement would be to position the cursor on the username in the login form. Is that possible?
The topic has been locked.
Support Specialist
7 years 8 months ago #59134 by alzander
We already set the username input field to a tabindex of '0'. That index is what tells the browser to allow the user to tab to the field. If it's the first input on the page, the tab key will bring the user right to it.

The problem with auto-focusing an element is that when an input is in focus (ready to be typed into) it can cause other issues with the page, like preventing scrolling. It depends on the browser how things behave when a textbox is editable, but it's something I'd recommend testing.

If you'd like to try to make the username field focused right on page load, it's pretty easy. Simply edit the /modules/mod_sclogin/tmpl/joomlaLogin_xyz.php file, where xyz is horizontal or vertical, depending on which you're using. Then, find the username input field that should look like:
<input name="username" tabindex="0" id="sclogin-username" class="input-block-level" alt="username" type="text"
Update that by putting the autofocus value in there, like:
<input autofocus name="username" tabindex="0" id="sclogin-username" class="input-block-level" alt="username" type="text"
Test that out and let us know how it goes. That's something we could add as an option to the login module so a user could choose to make the username editable on page load or not.

Thanks!
Alex
The topic has been locked.
Active Subscriptions:

None
7 years 8 months ago #59143 by jjbong
Thanks for the reply. I had already tried that, and it didn't work. I thought I'd missed something.

I'm using Chrome as browser.
The topic has been locked.
Support Specialist
7 years 8 months ago #59159 by mel
Could you please let us know a specific URL with that change in place so that we can see the behavior and see if we have any more suggestions.

-Melissa
The topic has been locked.
Active Subscriptions:

None
7 years 8 months ago #59160 by jjbong
You guys are great. You can see it at test.cal-sailing.org

I tried to send you login credentials, but for some reason it wouldn't let me send them. You may not need them.

thanks.


John
The topic has been locked.
Support Specialist
7 years 8 months ago #59179 by mel
Could you try taking off <b>tabindex="-1"</b> on the login-modal div (found in /tmpl/login.php)? In combination with the autofocus on the input like Alex suggested, I see the cursor on the username input box with this change. I am not sure if you're working on the site right now or not, but the autofocus was at first present for me, but then removed when I refreshed the page. Let me know if this helps.

-Melissa
The topic has been locked.
Active Subscriptions:

None
7 years 8 months ago #59200 by jjbong
That works great, thanks, at least on Chrome (not Mozilla, but that's OK).
The topic has been locked.
Support Specialist
7 years 8 months ago #59222 by mel
Thanks for letting us know. I've made an issue in our tracker to investigate this further for 7.1 release, but it sounds like you have something that can at least partially work for now.

-Melissa
The topic has been locked.