Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19051

HTML5 “autofocus” attribute (was: Scope of search / reduce scope / about "this")

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <2823752.UaOU2mbOze@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <usenet@PointedEars.de>
Organization PointedEars Software (PES)
Date Fri, 29 Mar 2013 23:27:54 +0100
User-Agent KNode/4.8.5
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject HTML5 “autofocus” attribute (was: Scope of search / reduce scope / about "this")
Newsgroups comp.infosystems.www.authoring.html, comp.lang.javascript
References <82de1eb3-5b51-4960-8b65-b43bbd5013b4@googlegroups.com> <632ccce8-2003-4597-b808-a77bee8b2852@googlegroups.com> <6235488.vrjhk3lj0x@PointedEars.de>
Followup-To comp.infosystems.www.authoring.html
MIME-Version 1.0
Lines 62
NNTP-Posting-Date 29 Mar 2013 23:27:56 CET
NNTP-Posting-Host 8ddaddab.newsspool3.arcor-online.net
X-Trace DXC=lU[L3]Nh_f;n`gW2MTm]<3McF=Q^Z^V384Fo<]lROoR18kF<OcfhCO;Qel<@S5]R;4DZm8W4\YJN<b@mF9jNikd5IQbgJMhLo07Ae4DRXcfOn;
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.infosystems.www.authoring.html:3785 comp.lang.javascript:19051

Cross-posted to 2 groups.

Followups directed to: comp.infosystems.www.authoring.html

Show key headers only | View raw


[X-Post comp.infosystems.www.authoring.html, comp.lang.javascript;
 F'up2  comp.infosystems.www.authoring.html]

Thomas 'PointedEars' Lahn wrote:

> Danny wrote:
>> see if this helps
>> http://www.wufoo.com/html5/attributes/02-autofocus.html
> 
> This is not the Web, you should not post only URLs as
> suggestions/solutions. The approach suggested there is
> 
>   <input autofocus type=text>
> 
> It is a good point, though.  The relevant specification is: [HTML5 CR]

It turns out that (at least in Chromium 25.0.1364.160 Debian 7.0 (186726)) 
the “autofocus” attribute causes the same usability issues as the focus() 
method when called in a “load” event listener: The document cannot be 
scrolled using the arrow keys.  [Also, the control thus focused may still 
not be visible.  This would need to be worked around with the 
scrollIntoView() method, which may not be available or functional, in a 
“load” event listener.]

So this attribute is best avoided as well.

Instead, the following approach is recommended:

  <input type="search" name="search" id="search" accesskey="x"
         placeholder="Description (shortcut: Access Key + X)"
         title="More verbose description (shortcut: Access Key + X)">

The “accesskey” attribute, which allows to use a keyboard shortcut so that 
the control receives the input focus, was introduced with HTML 4 [1] and is 
also supported in HTML5 (CR) [2].  The actual shortcut that focuses the 
control varies among browsers.  In Chromium 25.0.1364.160 Debian 7.0 
(186726) with a QWERTZ keyboard layout, it is <Alt> + <Shift> + <case-
insensitive value of the “accesskey” attribute>.

The “placeholder” attribute and [the “type” attribute value further show the 
affordance [3] of the control.  They can be augmented with a suitable 
“cursor” CSS property value.]  Should the “placeholder” attribute not be 
supported (HTML 4), the “title” attribute (HTML 4+) can provide the 
description, perhaps (but not necessarily) as a tooltip  [4, 5].  [It is 
also common and recommended to put a short, unobtrusive (e.g, darkgray) 
descriptive text above, next to, or below the control [6]; but whether this 
is suitable for you depends on the viewport dimensions and other factors.]


[1] <http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey>
[2] <http://www.w3.org/TR/2012/CR-html5-20121217/editing.html#the-accesskey-
attribute>
[3] <http://www.nngroup.com/articles/top-10-application-design-mistakes/>
[4] <http://www.w3.org/TR/REC-html40/struct/global.html#adef-title>
[5] <http://www.w3.org/TR/2012/CR-html5-20121217/dom.html#the-title-
attribute>
[6] <http://www.nngroup.com/articles/forms-vs-applications/>
-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Scope of search / reduce scope / about "this" thomas.lehmann@adtech.com - 2013-03-28 06:50 -0700
  Re: Scope of search / reduce scope / about "this" "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-03-28 15:29 +0100
  Re: Scope of search / reduce scope / about "this" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-28 18:13 +0100
    Re: Scope of search / reduce scope / about "this" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-28 18:33 +0100
  Re: Scope of search / reduce scope / about "this" Danny <dann90038@gmail.com> - 2013-03-28 12:37 -0700
    Re: Scope of search / reduce scope / about "this" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-28 21:01 +0100
      HTML5 “autofocus” attribute (was: Scope of search / reduce scope / about "this") Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-29 23:27 +0100

csiph-web