Christian Heilmann

Author Archive

Tackling automatic field focus usability issues

Monday, October 9th, 2006

One of my greater annoyances on the web is sites that automatically focus a form field when the page has loaded. Supposedly this should make it easier for you to use the product, as you are to log-in anyways, but there is one real problem with this.

If you try the demo page for a normal autofocus and start typing in your details, it can happen that you are already in the middle of your password when the page is ready and the focus gets shifted to the email field. I have seen this happening in Internet Cafes, where people inadvertedly revealed their passwords that way.

The reason is the simplicity of the scripts applied to focus the field when the page has loaded, which sometimes is as rudimentary as:


window.onload = function() {
document.getElementById( 'email' ).focus();
}

Now, I wondered how to make that better. A simple solution would be not to use onload on the window (and thus waiting for the document and all dependencies to be loaded before you proceed) but use onAvailable or equivalent solutions on the element itself instead. However, if the element to highlight is not the first, that would still make it possible to enter other data until the focus gets taken away from you.

Next I considered to read out the event target when the page has loaded and assume that if the target has a node name, someone is entering data. That proved to be to flaky (as [link:http://setmajer.com/,Chris Kaminski,colleague met] predicted, darn you!) as MSIE told me undefined whenever.

Thus, I dug deeper into my memory of form elements and unveiled the idea of value versus defaultValue. The latter, rather less known is the value set in the HTML attribute, whereas the value is the value of the field. Value changes when the user enters data or changes the element’s state (in case of checkboxes), but defaultValue doesn’t.

Using this information it is easy to set up a better autofocus script that will not focus the element when any of the data in the form deviates from the original settings in the HTML.


window.onload=function(){
var isfocused = false;
var elms = ['email','pw'];
for(var i=0;i

All you need to edit is the elms array listing the IDs of all elements to check :-).

[tags]Usability,Accessibility,JavaScript,webdevtrick,forms,autofocus[/tags]

Occulus Reparo

Monday, October 9th, 2006

My glasses just snatched and broke in two pieces this morning, which is why I had to feel my way to the office from the opticians. I now can do my own accessibility testing for the next few hours until the new pair is ready.

Amazing how much font zooming can help when you really need it :-)

Hours of fun with Google Code Search

Thursday, October 5th, 2006

As [link:http://www.kottke.org/06/10/google-code-search,Kottke.org informs us] the new [link:http://google.com/codesearch,Google Code Search] already unearthed a lot of interesting things, like WordPress logins, a key generator for Winzip and even something [link:http://www.google.com/codesearch?hl=en&lr=&q=spanish+inquisition&btnG=Search,totally unexpected] .

Update: [link:http://blog.predius.org/2006/10/05/fucks-per-source-package-and-license/,Predius also analysed with the search how many f*cks per language and package are in use]. PHP a clear winner there.

[tags]google,code,exploit,fun[/tags]

WSG meetup about Microformats on 19th October in London

Thursday, October 5th, 2006

Come to the Web Standards Group Microformats special on 19th of October at Westminster University’s New Cavendish Street Campus. (near Goodge Street tube station). It is free and there’ll be talk about Microformats and maybe beer afterwards. Sign up on upcoming.org if you want to go.

Speaking at the event will be Drew McLellan, Jeremy Keith and Mark Norman Francis. For more information on the event, and how to get to the venue please head on over to the WSG London mini-site.

[tags]Microformats,Web Standards Group,London,Geekmeet,TheTalkOfMarkNormanFrancis[/tags]

Accessibility in Trouble

Thursday, October 5th, 2006

Mike Davies, esteemed colleague and one of the silent web workers that do a lot more than they talk about vented some steam on a series of blog posts where he analyzes what is amiss in the world of web accessibility called [link:http://www.isolani.co.uk/blog/access/AccessibilityInTrouble,Accessibility in Trouble]. It is a great read and I congratulate Mike on his pragmatism and daring to “say it like it is” about the subject.

He is right, far too many publications on accessibility are stuck in the end-90ies and don’t consider technical advances. Web standards movements have come a longer way opening up to the enemycompanies like Microsoft, and the same interest and helpful attitude should become more common in the web accessibility world. There is just no sense in banging on about arbitary guidelines when [link:http://www.digital-web.com/articles/ten_reasons_clients_dont_care_about_accessibility/,people have their own problems to tackle]. Understanding their problems and helping them with real world guidance will make it better in the end for all of us.

Also note that Mike uses “vociferously” which makes it an instant win for me. We need more [link:http://www.43things.com/things/view/655495,usage of words starting with V] in general.

[tags]Accessibility,Commentary[/tags]