onmousemove event should fire when callback is set, so that initial mouse position is reported




DOM: Events
14 years ago
14 years ago


(Reporter: Gordon Matzigkeit, Unassigned)


Windows 98

Firefox Tracking Flags

(Not tracked)





14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
Build Identifier: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.5) Gecko/20031007 Firebird/0.7

When loading this page for the first time, or when clicking on the form button,
the button caption is `Unknown' because the onmousemove event has not fired.
I would expect this event to fire when document.onmousemove is set, so that
the initial mouse position is made known.

Having searched the web, I don't know of any other way of getting the initial
mouse position.  Since there is no workaround, I consider this a normal bug.
This bug needs to be fixed, or things like context-sensitive menus don't know
where to appear until the user moves the mouse.

Reproducible: Always

Steps to Reproduce:
1. Go to the above URL, but do not move the mouse.
2. Move the mouse.
3. Click on the submit button, but do not move the mouse.
4. Move the mouse.

Actual Results:  
1. `Unknown' is displayed in the form button.
2. When actually moving the mouse, the position is reported on the form button.
3. Again, `Unknown' is displayed on the form button.
4. Again, the position is reported when the mouse is moved.

Expected Results:  
The mouse position should be reported on the form button at page load, not just
after moving the mouse.
sending to events for triage
Assignee: general → events
Component: DOM Level 0 → DOM Events
Why exactly should a mousemove event fire when the mouse has not moved?  I
realize that it makes this particular program work as written, but that's hardly
justification... do any other browsers do that?

Comment 3

14 years ago
Boris raises a good point.  my IE 6 on Win2k with all the updates behaves the
same way as Mozilla does.  why should we want to have the onMouseMove fire when
there's been no mouse movement?  wouldn't we risk breaking a bunch of stuff that
works now?
Seems like what you really want is to be able to determine the mouse's position
at an arbitrary time, so you could run your script onLoad as well.  If there is
really no way to get the mouse position at an arbitrary time (for example, when
the onLoad script is executed) this may be either an unfortunate oversight in
the javascript spec (in which case it is beyond the scope of Mozilla hackers set
of things to fix) or just the way things should work (in which case it is not
something that should be relied upon to accomplish anything).  I guess the
former, but either way it seems like it's not really a bug, no?
Marking wontfix, since what we do makes sense (given that it's a mouse_move_
event) and since it's interoperable with IE.
Last Resolved: 14 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.