O'Reilly logo

Web Development Recipes, 2nd Edition by Chris Johnson, Mike Weber, Chris Warren, Brian P. Hogan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recipe 10Interacting with Web Pages Using Keyboard Shortcuts

Problem

Website visitors expect to use the mouse to interact with the site, but using the mouse isn’t always the most efficient way. Keyboard shortcuts are common; Gmail, Tumblr, and Facebook use them as a way to improve accessibility and allow users to quickly and comfortably perform common tasks. Facebook even supports some of the Vim commands discussed in Recipe 40, Changing Web Server Configuration Files with Vim. We want to bring this functionality to our site, but we need to make sure we don’t interfere with our application’s normal, expected behavior, such as our search box.

Ingredients

  • jQuery

Solution

Keyboard shortcuts use JavaScript to monitor the page for certain keys ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required