Fix bug #5888, broken keybinding behavior

This fixes a bug where an impossible keybinding assignment is possible, and also makes it behave similar to the gtk keybinder.

See Bug 5888 for more details.