Make it more obvious to tell which element is in focus when tabbing through elements

3

In Firefox, there is a dotted border around an element when it has focus. I find this impossible to see sometimes. What, if any, Firefox setting can we use to make focus more obvious.

Note that I want to do this through a Firefox setting NOT by editing a website's CSS.

For example, in SuperUser, when the Questions, Tags, Users, Badges, or Unanswered buttons are in focus, the dotted border in completely invisible. How can I make the border, say, bring pink or red and 5px wide?

Currently, the Questions link is in focus. There is no way to tell that it's in focus from the website's color scheme.

Would you believe that the Questions link is in focus.

I would rather it look like this when in focus, by changing some Firefox setting.

enter image description here

Shaun Luttin

Posted 2014-10-09T16:31:03.077

Reputation: 1 911

2

Are you using any special add-ons that mess with the CSS or similar? because the "focus" item is already in a ligher shade of blue for SU - also see the image in Oliver's answer

– user2813274 – 2014-10-09T17:53:43.990

@user2813274 Nope. I'm using Firefox out of the box without any special add-ons. – Shaun Luttin – 2014-10-09T22:49:12.340

@user2813274: That’s probably because "Questions" is the current/active page in the screenshot. – unor – 2014-10-11T12:39:40.270

Answers

3

You can define your own default styles by adding them to <Firefox profile directory>\chrome\usercontent.css. Any changes you make will take effect the next time you launch the profile (so if you're using it at the time you edit that file, you'll have to restart).

By adding the following to my profile's usercontent.css:

:focus {
  outline: #FF5500 dashed 2px;
}

I get the following:


enter image description here

A few notes:

  • usercontent.css only defines default styles that are used when no conflicting styles are defined in the web page. So, this works in cases where the focus outline is hidden for incidental reasons (such as the use of button images, as on this page), but it will not work if the website author has deliberately defined a CSS style that disables the focus outline, either for a given element or for the whole web page. It's widely considered bad practice to disable the focus outline without defining an alternative means of distinguishing the focused element, but unfortunately it's all too common.

  • If you don't see a chrome subdirectory in the profile directory and/or you don't see a usercontent.css file within that subdirectory, simply create them.

  • You can find the profile directory by entering about:support in the address bar (or selecting Troubleshooting Information from the Help menu), then clicking the Show Folder button in the Application Basics section.

Adi Inbar

Posted 2014-10-09T16:31:03.077

Reputation: 258

1Isn’t it even possible to overwrite author styles in usercontent.css? For example, with !important? – unor – 2014-10-11T12:46:22.353

1

You could use Stylish to set a different focus style. Something like this:

:focus {
    outline: 3px solid red;
}

The result would look like this:

enter image description here

Der Hochstapler

Posted 2014-10-09T16:31:03.077

Reputation: 77 228

Hmmm, I checked out the link, and the most recent review is titled "!!!! Should recieve MINUS 5 Stars !!!!" and is full of frantic warnings about how it messed up this person's browser and then he couldn't get rid of it...though most of the reviews are positive. I haven't tried it myself. Does it only customize on a per-site basis or can it apply default styles universally? (In any case, I added an answer explaining how to do it without the use of an add-on.) – Adi Inbar – 2014-10-09T18:53:14.403