How is the default focus outline implemented in browsers?
I'm talking about the solid or dotted line border that is shown around the element that currently has focus.
I thought that it was just CSS outline applied by the browser, such as
:focus {
outline: black dotted 1px;
}
But I've noticed that if I try to customize the focus outline by using CSS, the look of it is changed but so is the behavior in some cases.
Please see my question regarding focus outline for links with divs inside for examples:
Custom focus outline for links with div inside
(In short, if you have link with complex content and apply your own focus outline, things get weird)
Obviously the browsers don't just only apply the simple CSS above for focus outline. They must do something more to make the default work as good as it does, regardless of the element that it is applied to.
Does anyone know how it works?
Can I do something to make my custom focus outlines behave the same as the default ones?