Open
Bug 70427
Opened 25 years ago
Updated 4 years ago
Button in mouse events
Categories
(Core :: DOM: Events, defect, P5)
Tracking
()
NEW
mozilla1.0.1
People
(Reporter: erik, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
I've noticed that the event.button property does not return the correct value
in the following mouse related events:
mouseover
mouseout
mousemove
This is not a bug according to the W3C Dom level 2 specs but it makes event
handling soo much harder to do cerrectly. IE4+ supports the button property on
all mouse related events and I think that makes sense.
The following is from the W3C spec:
button of type unsigned short, readonly
During mouse events caused by the depression or release of a mouse button,
button is used to indicate which mouse button changed state. The values for
button range from zero to indicate the left button of the mouse, one to
indicate the middle button if present, and two to indicate the right button.
For mice configured for left handed use in which the button actions are
reversed the values are instead read from right to left.
A good example where there might be problems without this property is in simple
drag and drop scripts where the mouse button was released outside the element
listening for the mouseup.
(I assigned this to Blake Ross since he is the one assigned to bug 60703 which
is related to the button as well.)
Comment 1•25 years ago
|
||
Do we want to do this?
Comment 2•25 years ago
|
||
Erik, I think Mozilla has implemented event.button for a *loong* time.
Comment 3•25 years ago
|
||
Erik, what's the difference between this one and 60703?
Both seem to cover incorrectly numbered mouse buttons.
| Reporter | ||
Comment 4•25 years ago
|
||
The problem as I see it is that the button property gives garbage in non click
realted mouse events. It should optionally be possible to tell what button is
pressed in a mousemove event for exmaple.
There are however issues with how button is defined in the W3C specs. IE solved
this in a much better way.
The following is taken from the MSDN
iWhichButton Integer that specifies or receives one of the following values:
0 Default. No button is pressed.
1 Left button is pressed.
2 Right button is pressed.
3 Left and right buttons are both pressed.
4 Middle button is pressed.
5 Left and middle buttons both are pressed.
6 Right and middle buttons are both pressed.
7 All three buttons are pressed.
I don't see a solution for when multiple buttons are pressed that follows the
W3C specs but when a sinlge button is pressed a good idea would be to return
that value instead of the garbage value.
The best value (IMO) for no button pressed would be null (or possibly -1)
Bug 60703 was filed because the property was off by one for mousedown, up and
click. This bug is for the non click related mouse events.
| Reporter | ||
Comment 5•25 years ago
|
||
Comment 6•25 years ago
|
||
The next is just my opinion, of course:
1) Can you give a scenario where multiple simultaneous button clicks could be
used. I know of no Win32 program that uses this. (Well, except Quake :-) )
2) I think the button value in non-click mouse events should be treated as
garbage. It'a pity that the DOM mouse buttons don't start at 1 though.
3) In the example you give in your first comment, it would be easy to catch
mouseout for the element.
Updated•25 years ago
|
Target Milestone: --- → mozilla1.0
Comment 9•24 years ago
|
||
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1
(you can query for this string to delete spam or retrieve the list of bugs I've
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Updated•24 years ago
|
QA Contact: madhur → rakeshmishra
Updated•23 years ago
|
QA Contact: rakeshmishra → trix
Comment 10•23 years ago
|
||
this is dom events
Assignee: joki → saari
Component: Event Handling → DOM Events
QA Contact: trix → vladimire
Comment 11•23 years ago
|
||
Can someone be more specific as to what I am supposed to notice in this testcase
please?
Or create a testcase that just shows the button issue?
Thanks
| Reporter | ||
Comment 12•23 years ago
|
||
This seems to have changed a little since the last time I checked on this.
Now eventObject.button always return 0 when a non-click related event is fired.
To see this scroll the page down so you can see the object.button row. Now press
the mouse buttons and move the mouse around and you'll see that the button
property is always 0 (which means left button).
In a perfect world it would be possible to tell which buttons are pressed in a
mouse move event.
Comment 13•23 years ago
|
||
mkaply: basically .button should tell us which mouse button(s) are pressed. I
think most uses can be workarouned using existing event attributes though.
Comment 14•21 years ago
|
||
mouseover et al still appear to return 0 in all cases, regardless of which
button is pressed or whether any button is pressed at all.
And since everyone agrees that Microsoft's solution is better here, perhaps add
a 'buttons' property to the MouseEvent object that uses Microsoft's model? (W3C
could adopt it for DOM3....)
Updated•17 years ago
|
Assignee: saari → nobody
QA Contact: vladimire → events
Comment 15•8 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046
Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.
If you have questions, please contact :mdaly.
Priority: -- → P5
Updated•4 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•