The Hotkey bug. My arch nemesis.

"Duplicate hotkeys" is probably the most common type of bug I see in my software. A duplicate hotkey bug exists where you have two controls with the same mnemonics, like in this screen shot:

As you can see, two controls are using 'A' as hotkey. This makes it slightly harder to navigate the UI without using a mouse. These bugs rank fairly low on the priority scale - it's not like the application is fundamentally broken. Still, we put a lot of effort in trying to not ship the product with these bugs. Accessibility is important.

Over the years, we've managed to significantly reduce the number of these bugs. Some of them are very easy to prevent, some you can't possibly predict. Today I'll just talk about the easiest ones.

The screen shot above shows the simplest possible scenario - a dialog (or menu) containing only statically defined text. No items change text at runtime. No controls are added or removed at runtime. The dialog isn't combined with anything else at runtime. Everything we need to know about the dialog is known when we localize.

This is quite common, and it's very easy for me to avoid duplicate hotkeys. As I localize the file, I can go through dialog by dialog or menu by menu and make sure not to use the same letter twice when I assign hotkeys. It's of course also quite doable to automate a check that would find all dialogs with duplicated mnemonics, just to make sure nothing slips through.

Because this is such a basic case - so easy to prevent if you're careful, so easy to spot even if you're not - we hardly have any of these bugs any more. In fact, I've promised myself to never again check in files with this type of duplicate hotkey (and I don't think I have for a couple of years now...).

Next up - we raise the bar a little bit. And this isn't limbo.


This posting is provided "AS IS" with no warranties, and confers no rights.