keyboards and web applications

Web applications are still evolving. This we know. One thing any power user tends to pick up on pretty quickly in desktop applications is the keyboard shortcuts. We just cant get enought of them. Why dont we see them more in web applications? Well a couple of reasons as it happens:

Personally I think in some cases keyboard shortcuts would be nice, I have a little plan for something in mind as well so started experimenting. The clash issue I’m going to leave for another post as it will take a bit of brute force experimenting but I did start playing with a simple way of assigning functions to keys.

The following code creates an object to store the lookup/hash/two dimensional array (pick one you like). This is a simple associate between a key, and a function to run when it’s pressed. A function is then assigned to the onkeyup and onkeydown events which monitors them, checks for one of the keys in the lookup to be pressed (in this case along with the ctrl key) and runs the assigned function.

<txp:php> include('/www/htdocs/morethanseven/scripts/sample/keyPress.js'); </txp:php>

A simple library function is used to add the event to the document onload. My library obviously includes other helper functions but we dont need any of those for this example.

<txp:php> include('/www/htdocs/morethanseven/scripts/sample/lib.js'); </txp:php>

Some improvements I can spot from here which I’ll implement as I actually take this out of the lab and into something production like.

I’ll try get round to the look at keyboard shortcut clashes, or link to someone who already has, as I get round to it. In the mean time, what do people think about the use of keyboard shortcuts in web applications? Any good or bad examples welcome.