Why HTML access keys do not work in Firefox Linux
Well, they don’t work for me – haven’t worked since Firefox 2, I think.
If you’re not sure what I’m talking about then its about the ability of web pages to define keyboard shortcuts to access and enable features on the web page using the keyboard instead of the mouse. Common actions are to focus text edit boxes or to trigger links directly.
This is very useful from a usability point of view, and the best implementation so far that I’ve seen is in KDE’s Konqueror browser (and other places where the KHTML rendering engine is used, for example in KMail) where you can click on CTRL and then Konqueror shows you which keys are available on the web page – each on top of whatever part of the web site defined it.
In Firefox it used to be much simple – just use ALT with the assigned key – for example if the accesskey on an element is defined as “k”, use ALT-K to access it. Then with Firefox 2 it got broken – ALT and a key only triggered menu access, and I could never be bothered to find out why so I just let it go.
Apparently its all my fault – Firefox 2 has introduced a change in handling access keys and you have to use ALT+SHIFT+key in order to trigger an access key. Unfortunately, for me – like most Hebrew speaking users – ALT+SHIFT is used as the keyboard layout switching, to switch between Hebrew and English. This is indeed modeled after the MS-Windows keyboard combination, but I’m sure that most Linux users that use a bilingual keyboard employ this keyboard shortcut. Many Linux distributions these days have this setting pre-configured if you enable multiple keyboard layouts.
I’m often frustrated by software that ignores this and sets up ALT+SHIFT as modifiers for useful keyboard shortcuts – for example Eclipse, my favorite development environment, uses ALT+SHIFT for most keyboard shortcuts. And this is also where the Firefox access keys have gone to – when the modifier used for access keys is the same modifier used for changing the keyboard layout to one where the key that I want to use does not exist – then its pretty much inaccessible.
Fortunately – its easy to fix once you know what you’re doing1. To set the Firefox access keys modifier to something you can use, follow these easy steps:
- Open a new tab or window and type in the location “about:config” (without the quotes, obviously)
- When the scary “oooh, its going to void your warranty” window appears, click the “I’ll be careful” button
- Now in the top of the window is a “Filter” edit box, where you need to type in “ui.key” to get a list of the settings that control the shortcut key modifiers
- You should notice that
ui.key.contentAccess
which is the modifiers control for the HTML access keys is set to 5. According to this article in MozillaZine this means that both ALT and SHIFT together are the modifiers. You can set it to only use ALT by double clicking the line forui.key.contentAccess
and change the value to “4”. Unfortunately this means that both the standard Firefox menu access and the HTML access keys are using the same modifier, and if there is a conflict (for example the access key “f” conflicts with the file menu) then the Firefox menu wins. This can be solved in one of two ways:
- Either set the Firefox menu modifier to something else – for example, change
ui.key.chromeAccess
to “5” so that the Firefox menu will use ALT+SHIFT (which is useless as we noted) or to something else that makes sense to you - Or use some other useful combination for
ui.key.contentAccess
. I used “3” that stands for CTRL+SHIFT, which is my favorite shortcut modifier (after CTRL and ALT 😉 ). One can probably also use “8” to set the “Windows key” as the modifier – it works on my machine, but I’m not sure I can get used to it, and it will probably conflict with my “fancy 3D window effects” that are mostly triggered by the “Windows key”.
And that’s it – you should be good to go. You should probably also close the configuration window now, before you do something you’ll regret.
And now I can use access key “p” to Publish this article.
- which as I mentioned took me a while – 1.5 major releases for that matter [↩]
Thanks a lot, very usefull!
[…] By changing the X server behavior to trigger the layout switch only when releasing the shortcut keys and only if no other key has been pressed, we can now enjoy a perfectly working “switch to previous window” action Also all of the (default) ALT+SHIFT+<some key> keyboard shortcuts in Eclipse will finally work for me out of the box. This will also solve the Firefox keyboard shortcut problem I talked about in this post. […]