Neil's Place

January 14, 2013

So What’s Up With That Strange Focus Model on Mac?

Filed under: Mozilla — enndeakin @ 8:45 pm

This is a question that comes up a lot from other people when you are somebody that is expected to investigate and fix focus related Firefox bugs. People are confused as to why Mac has such an unusual way of handling of focus. The questions and confusion can usually be summarized as follows:

This Macintosh doesn’t behave exactly the same as the Windows (or Linux) machine I’ve been using for years does! It must be wrong!

Now I don’t know the actual reasoning as to why Apple might have chosen the particular focus behaviour they did, not for that matter why Microsoft, or any other platform vendor might have chosen the behaviour they did, but I can make some guesses.

On Windows, it is expected that a user uses both the mouse and the keyboard to interact with the user interface. The user is expected to only be interacting with one control at a time. If the user starts to interact with a control with the mouse, it is expected that the user, when then using the keyboard, will want to interact with that same control. There are exceptions however, for example, buttons on certain toolbars. Assuming this, Windows will move the focus to a control when you click on it.

The Macintosh however assumes that most people who are using a mouse aren’t going to interact with controls with the keyboard if they don’t need to. For instance, while you could toggle a checkbox by tabbing to it and pressing the space bar, most people don’t do this. Thus, the focus is only placed on those controls where one must use the keyboard to interact with it, or those where keyboard interaction is quite common. This means, text entry fields and list boxes. For text fields you need to be able to type in them and perhaps people commonly change items with the cursor keys in lists (or perhaps because you cannot select multiple non-contiguous items in a list without holding a key down) Thus, on Mac, clicking on any other control that isn’t a text field or list keeps the keyboard focus where it is rather than changing it.

For most typical users, it is quite handy to only have textboxes (and lists) in the tab navigation order. For example, when entering a login and password or other personal information, you can cycle between only those fields where you enter text, rather than having to skip over the various other buttons and links that might appear nearby. In addition, you can click the ‘Remember this Password’ checkbox and continue entering the password. On Windows, you would need to click the password field again. You can always set the ‘Full Keyboard Access’ setting to make all controls part of the tab navigation sequence.

Modern versions of Windows don’t show focus indicators (the dotted rings) around controls until the keyboard is used to navigate within a window, for example by pressing Tab or an access key. There’s a system setting that can always enable focus indicators. In addition, older versions of Windows that didn’t have this setting will always show focus indicators. Actually, there’s one, almost secret, way to show focus indicators by default and that is to open a dialog box by using the keyboard instead of the mouse. What heuristics Windows uses to determines this is unclear, but you can see the effect for yourself by opening the Properties dialog for a file. When using the mouse alone the focus indicator doesn’t appear on a control, whereas if you navigated the menu and selected Properties using the cursor keys and Enter, the focus indicator does appear on a control in the resulting dialog. This little known feature works in Firefox too! (Or it would if the main menu wasn’t so broken.)


Here’s one! The focus ring has appeared around the button.

Because Macintosh doesn’t focus most controls when clicking them, you rarely see the blue glowing focus rings around them. However, if one was to focus, for example, a button manually using code, the focus ring will appear around it. You can see this if you look around the Mac OS X UI a bit, even without using the keyboard at all.

Here is a rough guide to how the focus is expected to behave within Firefox across the three main platforms.

Create a free website or blog at WordPress.com.