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 being ...

Get Web Development Recipes, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.