Self-importance. Entitlement. Snobbery.

The IE7 hover ghost bug

Jul 14 2009

Ran into this one today, in somewhat unusual circumstances: I had a hover style where buttons inside a table row only appeared when the mouse was over the row, and if you clicked on one of the buttons but moved the mouse into another row before releasing the mouse button, the previous row would stay highlighted.

The authoritative writeup of the bug, and most others, refer to the problem happening with dynamically-displayed submenus, but make little mention of my particular problem. There was some hope that triggering hasLayout would fix the problem, as it’s the closest thing we have to a magic bullet, but it (shocker!) didn’t work for me.

What did work for me was reverting back to the brute-force method one had to use for older versions of IE: using JavaScript onmouseover/onmouseout events to trigger a hover style1 rather than the :hover pseudoclass. So much for IE7 implementing :hover on non-anchor elements. Sigh.

1 See the first comment. And shame on you, Webmaster World, for not having permalinks to the comments. Get a load of their generated source, too: they’re still using font tags. Seriously?! And this is a resource for webmasters? Come on.