An explanation
The script on this page places a small grey asterisk next to the focused element. Hit the TAB key to focus the next element.
- Internet Explorer 6 & 7 correctly hide the on the anchor with the hidefocus attribute, but not on the anchor without.
- Of course, Internet Explorer does not adhere to any :focus rules.
- Opera 9 does not adhere to either, and highlights the current anchor tag with a light grey background.
- In addition, Opera 9 will only TAB to the anchors that have a tabindex attribute set.
- Safari 3 Beta will focus the first element when asked to by the script, but does not tab through anchors at all.
- In addition, Safari 3 Beta does not adhere to any :focus rules.
- Firefox 2 does everything perfectly.
The Output
I am an ordinary anchor with a focus rectangle
I have no focus rectangle when tabbed to or clicked
I have a bright orange solid focus rectangle
I have a :focus pseudo class, but no hidefocus or tabindex attribute
The CSS
.noFocus:focus {
outline: none;
}
.brightFocus:focus {
outline-style: solid;
outline-color: #f90;
outline-width: 3px;
}
The HTML
<a href='#' class='asterix first'>I am an ordinary anchor with a focus rectangle</a><span></span><br />
<a href='#' class='asterix noFocus' hideFocus='hideFocus'>I have no focus rectangle when tabbed to or clicked</a><span></span><br />
<a href='#' class='asterix brightFocus'>I have a bright orange solid focus rectangle</a><span></span><br />
<a href='#' class='asterix last'>I am another ordinary anchor with a focus rectangle</a><span></span><br />
© 2007 Marc Heiligers (marc[at]eternal.co.za)
.eternal