Neil's Place

July 3, 2009

What’s Next for Focus

Filed under: Mozilla — enndeakin @ 3:52 pm

Now that the focus work has been completed, I’ve been looking at some follow up focus work to finish up. There have been a number of regressions and crashes found but they were all fixed very easily. I think the new focus code is much easier to work with, enough such that each regression was easily fixed in under an hour or so of work, except for one which took a few hours. That’s much better than the two weeks it took before to investigate a bug, try to fix it and then fail at it.

There’s still some issues surrounding plugins on Linux but Karl knows quite a bit about how focus should work on GTK so I’m confident we’re going to have something working there.

There’s a push to get bug 418521 fixed which affects which elements should be focused on mouse clicks and when they should draw focus rings. The idea here is that focus rings shouldn’t be drawn in some cases. In others, such as Mac, elements shouldn’t even be focused when clicking them.

The -moz-user-focus property is currently used in XUL to identify if an element may be focused or not. This doesn’t belong as a style property. The logical choice is to use an attribute instead. That can be used, but I’m currently leaning towards a feature added to XBL which lets one set default focusability behaviour for an element. This would possibly be combined with some ideas I have about how to combine accessibility with XBL. I’ll revisit this when the XBL2 implementation is further along. This may also help with some issues where certain elements have special-cased focus behaviour, for instance, those that need to retarget focus when clicked, or when an accesskey is pressed.

There’s still some modules which are caching focus, accessibility and I think the IME code might be but haven’t investigated it too closely. Focus shouldn’t be cached anywhere but the focus system.

Also, I want to get rid of nsFocusController.cpp, which doesn’t do much focus related anymore. I tried to do that before the focus work was completed but ended up needing to create a chain of other patches to fix various other issues. I need to go back and finish that up.

I think my goal for the next little while is to just finish up all the patches and partially completed work I have had sitting around for a while. I’ll write more about those things later.



  1. Sounds great. I’ve also found that the mark of success for a big refactoring like this is not how many regressions there are, but whether they’re much easier to fix than they used to be. Bravo!

    Comment by Robert O'Callahan — July 3, 2009 @ 10:16 pm

  2. Will this help fixing the tab strips in Edit > Preferences, Tools > Add-ons, and Tools > Page Info to show focus? (bug 334370)

    Comment by skierpage — July 4, 2009 @ 8:01 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: