Skip to content

A podcast for those who design, develop and run websites.

Boagworld is the personal website of Paul (the Wurzel) Boag who lives in the heart of rural Dorset. He produces a weekly podcast along with Marcus (pop star) Lillington on all things relating to building and running websites.

Latest shows

127. Context
In this week's show we discuss taking context into consideration when designing websites and we answer your questions about video for an elderly audience and the most influential books in the industry. 
126. Scaling
In this weeks show we learn lessons from the botched iPhone launch here in the UK. We chat to Jeff Veen about the designer / developer relationship and Marcus talks about adding jingles to your website.
125. Copy
In this weeks show we discuss how to give personality to your site copy and we talk with Elliot Jay Stocks about going freelance.
124. HTML 5
In this weeks show we explore how to create better online surveys and Lachlan Hunt joins us to discuss HTML5
123. Plight
In this weeks show we review Textmate and the Top 5 Tips for Web Designers and we discuss the plight of in-house designers.

or view all shows

Have your say

Leave a message for the show...

Buy my book: The website owners manual. A book for all those involved in designing, developing or running websites on a daily basis.

Don't break the default browser behaviour

Published on: October 27, 2005 by Paul Boag

Isn't it fun how sometimes you think you are being helpful when in fact you are making things far worse? Take for example the small piece of JavaScript this site uses to focus the cursor in the search box.

You would have thought that after more than 10 years in web design I would have learnt my lesson by now. Before you do anything on the web, carefully consider the consequences.

Just trying to help

One day I was loading up Google when I noticed that it had automatically places by cursor in the search box. "Great", I thought, "That saves the user having to select the field before they start typing their keywords. I will have to do the same thing on boagworld". Without another thought, I looked around in Google's code, found the piece of JavaScript and added it to my site.

The consequences

Over a year later I was writing yesterday's post and trying to add a link for users to add their comments at the end of the post. I wanted the link to jump directly to the comments block at the bottom of the page. "Easy" I thought, "Just add #Name of ID at the end of the address". I was therefore amazed when for some reason this didn't work and instead jumped the user halfway down the page for no reason.

It took me some time to realise that the JavaScript was jumping the user back up to the search box, which was about half way down the page. Suddenly, for the first time I was thinking about the consequences of that tiny bit of JavaScript. I realised not only would # links not work but that there were other costs of focusing on the search box. I realised that:

  • I was breaking the tab order for users who couldn't use the mouse very well.
  • there is a strong possibility that speech browsers will start reading from the position of the cursor rather than the top of the page (I have yet to check this)
  • users at 800x600 are immediately jumped half way down the page rather than viewing it from the top

And the morale of this story...

The morale of this story is that insignificant changes to your site, especially those that mess with the default browser behaviour, can have huge consequences. It is not enough to presume that because it works successfully on another site that it will be okay on yours.

Comments

Comments are for the discussion of this post. If you have other questions / comments then post them to the forum or send me an email

  • Post by Ed on October 27, 2005 4:48 PM

    ....and because you used Unobtrusive JavaScript, it was simply a case of removing the reference to the file with the code in to stop the problem?

  • Post by Paul Boag on October 27, 2005 6:08 PM

    Exactly...sweet!

  • Post by Jon Dowland on October 28, 2005 10:10 AM

    Is it possible to adjust the JS to not break the specific situations you've mentioned, but still work in the general case? Can you detect that the user is visiting an anchor from JS? Perhaps a less-obtrusive solution, such as binding the jump-to-searchbox stuff to an access key..

  • Post by Paul Boag on October 28, 2005 4:28 PM

    The bidding of the function to a key press or on click event might be possible but I think the key here is not to do it automatically where the response is unexpected to the user.

Leave a comment

Additional Information

Supporting boagworld

Boagworld only exists thanks to the kind support of the following people. Check them out.

Speaking and writing

Supported by feed.informer.com