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

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.