Closed Bug 159711 Opened 22 years ago Closed 22 years ago

mouse click events not being fired on document elements for buttons other than left click

Categories

(Core :: DOM: Events, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 156137

People

(Reporter: will, Assigned: joki)

References

()

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1a) Gecko/20020611
BuildID:    2002061104

The page has three event listeners defined listening for clicks on the div. One
added by javascript on the document. One added by javascript on the div. And one
inline in the declaration of the div.

When left clicking all three fire. Any other button will only cause the document
listener to fire.

Reproducible: Always
Steps to Reproduce:
1.Load http://odin.himinbi.org/~will/test_table_mouseclick.html
2.Click on the div (left and right)
3.Note the alerts that come up

Actual Results:  On left click I get three events. On right or middle I get one.

Expected Results:  Mouse clicks should fire click events regardless of the button.
The behavior that this bug reports is mentioned in bug #156137 which states 
that the behavior arises from the similar behavior in ns4 and ie5.

The particular situation that I am facing is from a dhtml color picker that I 
am working with:

http://honors.tntech.edu:8080/play/template/ColorTable.vm?
hues=20&saturations=10&brightnesses=12

which has a bunch of table elements with different colored backgrounds and the 
page color changes with mouseover. The table changes (hue, saturation or 
brightness depending on where you click) so left click is already taken. There 
is a div which displays the css rgb() value for the current color and it is 
handy to be able to get to it so as to copy the text for pasting into a 
stylesheet.

I would like the right click behavior to turn off the color changing, but given 
the current behavior it is only possible to do that be adding an event listener 
on the whole document. I have been using event.preventDefault() to cancel the 
context menu though and I would like not to do that for the whole screen; only 
for the table.

I recognize that shift/control/alt click are available, but it is certainly 
more of a kludge than a simple right click.

Is there some way that the behavior could be on in standards compliant mode and 
off in quirks mode? Maybe that would still break too many sites... The thing I 
liked about mozilla though is that I can go to the w3c site and read the spec 
and write my code and it just works. If it doesn't work then I need to go back 
and figure out what I did wrong. =)

It is a really solid piece of software.

*** This bug has been marked as a duplicate of 156137 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
verifying
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.