Thursday, April 3rd, 2008
But I’m not moving my mouse!
<>p>PPK has detailed another “when a browser vendor codes to IEs bugs… and they actually get around to fixing them” problem.It appears that IE used to do something strange with onmousemove, and events would fire every X seconds even if you haven’t moved the mouse:
When doing my new mousemove test I found a bug in IE5-7 that I was previously unaware of. When the user moves the mouse over the element, the mousemove event fires many times, as it should. However, when the user stops moving the mouse, IE5-7 continues firing the event every once in a while. This stops only when the mouse leaves the target element entirely.
This is obviously a bug: when the mouse does not move the mousemove event should not fire.
The IE team reacted correctly: the bug has been solved in IE8b1. When the mouse does not move any more the mousemove event stops firing, as it should.
However, this same bug was recently introduced in Safari (Windows) and Opera!
Safari 3.0 and Opera 9.26 support mousemove correctly, but Safari 3.1 and Opera 9.5b have copied the IE bug.
Related Content:











Further research shows that something odd is going on, and that this might not be a browser bug after all, but a OS bug. See the ongoing conversation in the comments on my piece.
I’ll have to check out Opera for Linux when I get home, see if it does this (stupid XP at work).
Somewhat unrelated but since we’re talking about mouse event bugs… In the process of hacking Safari/Opera support into the Harley-Davidson Ride Planner (MS Virtual Earth shortcoming), I’ve come across a bug in Mac/Safari (doesn’t occur in Win/Safari) that the right-click (or option-click, etc) doesn’t fire onmouseup and onmousedown events, only onclick (it does fire oncontextmenu though).
That’s strange…
If it’s an OS bug, than i would have noticed some anomalies in my C# test app, that registers lowlevel system hook for mouse/keyboard events, but i haven’t.
My OS is Win XP SP2.
IE7/8 is being more PIA than relief. Recently I had found that document.cookies always return FALSE no matter it’s enabled in any zone(Trusted,Internet etc)
@posure: I’m fairly certain that is an OS-level issue. OS X treats non-left-click events differently than it treats left-click events. I suppose Safari could hack around that, but it might be incorrect to do so: after all, you can trigger a context menu without a mouse click. Anyway, I think Safari 3.1 is cleaning up some incorrect event behaviors in previous versions (see the key events) and I wouldn’t be surprised if their official position is “use oncontextmenu” instead.