I realise that this question may be quite specific CSS-wise, but it feels more like a UX question than a StackOverflow one.
My question is should links have a :focus state that replicates their :hover or their :active? I've had a read of some other sites that explain their usages (and I understand them clearly), but none seem to talk about the UX of the variants. I've also yet to find a question on here that properly addresses exactly this problem.
The way I see it is that :hover is a mouse-users indication that there is some interactivity, and that :focus is the same but for a keyboard-user; whereas :active shows that an interaction has commenced. Be that clicking, or hitting enter (although the latter would almost definitely be instantaneous so there might be no perceived :active state).
Is this the correct way to look at it, and if so is this CSS the correct way to approach it:
a {
color:blue;
text-decoration:underline;
}
a:hover,
a:focus {
color:red;
}
a:focus {
outline: dotted thin;
// This is a slight tweak to browsers' standard :focus outline
}
a:active {
color:green;
}
I'd be interested to know what people felt, and if there were any examples where people have looked at the merits of both the :hover, :focus & :active
and the :hover & :active, :focus
approaches, and which they found to provide a better user experience.
Thanks!