When an element like a dropdown menu or link is clicked, Firefox shows a dotted outline. I see that it acts as an important visual indicator for keyboard-based navigation (among others), but in my case (a news website), there are so many links in the navbar that it'd make keyboard navigation, TAB, TAB, TAB ..., quite painful and unrealistic (i.e. why'd anyone want to press a key that many times when they can simply use a mouse instead?) and so, I want to remove it.
EDIT: As for accessibility... since I am using something like ELEMENT:focus { border: 2px solid #359; }
for menus, text-decoration: underline;
for links, etc. my website is accessible via keyboard as well. For example, it looks like this upon pressing tabs multiple times (call it an unintended side effect!):
Upon searching, I found out a simple way to remove the outline:
:focus {
outline: 0 !important;
}
::-moz-focus-inner {
border: 0 !important;
}
EDIT: This is added at the top of the stylesheet that's loaded right after Twitter Bootstrap CSS.
I needed to use the !important
declaration as the cascading didn't work, i.e. I tried this and it didn't work:
*:focus {
outline: 0;
}
*::-moz-focus-inner {
border: 0;
}
Is there a way to accomplish what I am after through cascading and not having to use !important
or defining specific elements (e.g. a:focus
, button:focus
...)?
If the answer is no, is there a specific set of elements that Firefox does this to? If so, what are they? (<a>
for sure.)