Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Both contextmenu/click events fire in Firefox, only contextmenu in Webkit

Tags:

javascript

Chrome fires a contextmenu event, yet no click event for right-clicks. Firefox fires both.

I'm trying to find some official reference or explanation, and I'm surprised I've never come across this yet.

http://jsbin.com/zawifokumu/1/edit?js,console,output

document.addEventListener('click', function(event) {
  console.log('click');
});
document.addEventListener('contextmenu', function(event) {
  console.log('right click');
});
document.addEventListener('mousedown', function(event) {
  console.log('mousedown');
});
like image 246
helion3 Avatar asked Nov 10 '22 12:11

helion3


1 Answers

It appears that the Firefox people think this is a bug. But not a very important bug, judging from the fact that it's 14 years old now.

like image 165
Isaac Avatar answered Nov 15 '22 11:11

Isaac