Plenty of ink has already spilled in this war.
- 10-year-old Firefox bug with 20 duplicates and no sign of discussion slowing down
- A Hacker News thread
- How to prevent keystroke grabbing/hijacking?
- How do I prevent pages I visit from overriding selected Firefox shortcut keys?
- How to prevent sites from hijacking keyboard shortcuts
On one side is truth and justice, on the other, the misguided people who think their sites need a keyboard shortcut “feature.” This comment on Super User sums it up:
It’s so absurd to me, because the only way anyone will discover this “feature” is by trying to use [the slash key] for its usual purpose! The only people who are affected by this are the ones who are frustrated by it!
Custom shortcuts are bad for accessibility, bad for power users, unlikely to be useful to most users, and difficult to implement correctly.
Custom shortcuts break user expectations¶
Not only do custom shortcuts interfere with what power users expect of their browser, but they are even worse for users who can’t physically use a mouse. This includes motor impairments and, to some extent blindness.
“Wait,” you might think, “if my users can’t use a mouse, won’t my shortcuts help them?”
Your users won’t know what your particular shortcuts are and you have a good chance of breaking shortcuts that they need to navigate your site. Screen readers, for example, provide many shortcuts you don’t know, but their users require.
Custom shortcuts are hard to implement¶
Oh sure, it seems simple enough, but wait until you really get into the details.
Have you thought about international keyboard layouts? If “dead key” doesn’t mean anything to you, you don’t know enough to implement keyboard shortcuts reliably.
Do you know how all the keyboard event parameters differ? Here are some of them:
When you should make custom shortcuts¶
Despite the above, there are times when custom shortcuts are appropriate, so Keyboard Savior Xtreme makes exceptions.
- Custom modals like popups should always impleemnt
- Rich-text editors and similar should implement shortcuts analogous to the well-known shortcuts in their native counterparts
In almost every other case, custom keystroke handlers are a mistake.