Keyboard Accelerators and Characters with Accents

When you want to open the "File" menu in a program, you press Alt+F. This is an accelerator because the developer has configured that F is an accelerator character. In the source code, the File menu string is written as "_File", which means that the character after the underscore is the accelerator character. In this article we discuss the issue when we set the accelerator character to a Unicode letter that has an accent, such as "_Árbol" or "_Ἕλληνες".

Short story

It is better to avoid setting the accelerator character on a letter that requires several keystrokes to produce. For example, when our keyboard layout requires dead keys to type those characters.

Discussion

The source of the problem relates to the user's keyboard layout, and the fact that it may require dead keys in order to print characters such as áéäẽ, etc. Due to the dead key sequence, it is currently not possible to do things like Alt + <dead_acute> + <a>, the sequence is canceled as soon as Alt+dead_acute is pressed.

If however you could get á in your keyboard layout by pressing a single key (that is, no need for dead key), then the accelerator would simply work.

Is it a GTK+ bug or a Xorg bug?

GTK+ could be modified so that when it sees "_árbol", it would actually register it as if it work "_arbol", so pressing Alt+a would simply work. The downside is that it would not be able to distinguish between aáäãâà, etc. Would that be a realistic problem however?

In addition, it might be possible for GTK+ to be enhanced so that it understands such complex sequences like Alt + <dead_acute> + <a> and Alt + AltGr + Shift + @ + a (for 'ǎ'). However, would it be usable for the end-user to have to press several keys to access the accelerator?

References

See http://bugzilla.gnome.org/show_bug.cgi?id=104112 for some related discussion.

SimosXenitellis/KeyboardAcceleratorsAndAccents (last edited 2009-04-06 04:45:40 by MatthiasClasen)