Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-28 08:30:33

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Auto focus on Username input field

On the the admin side’s login page, we could focus the username field:

$('input[name="p_userid"]').focus();

Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#2 2011-03-28 12:41:31

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Auto focus on Username input field

+1: )


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2011-03-28 13:25:35

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: Auto focus on Username input field

+1 Small detail, but important

Offline

#4 2011-03-28 13:56:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: Auto focus on Username input field


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2011-10-22 20:37:12

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: Auto focus on Username input field

Maybe a solution (html5 new attributes):

<input type="text" value="" name="p_userid" class="field" tabindex="1" id="name" autocomplete="off" autofocus="autofocus">

Username isn’t stored into input field ( autocomplete="off" ) even on focus ( autofocus="autofocus" ).


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#6 2011-10-23 08:03:35

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,196
Website

Re: Auto focus on Username input field

Pat64 wrote:

Maybe a solution (html5 new attributes):

<input type="text" value="" name="p_userid" class="field" tabindex="1" id="name" autocomplete="off" autofocus="autofocus">

Username isn’t stored into input field ( autocomplete="off" ) even on focus ( autofocus="autofocus" ).

Why would you want to prevent the user to save the username/password on her computer ?


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#7 2011-10-23 09:02:29

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Auto focus on Username input field

I don’t see any benefit to autofocusing, unless there is just single text input field on a page (like Google homepage for example). I also avoid using tabindex myself – it plays havoc with keyboard-only page navigation and is unnecessary if you’ve laid out the code properly in the first place.

Offline

Board footer

Powered by FluxBB