I've seen a lot of questions and answers on SO and other places that talk about right-click events and how to catch and process them using JavaScript, usually using the .button attribute of the .button object generated by the browser.
However, one thing I did not find, probably because this is a rather strange request, is how to catch and handle right-clicks on the HTML <button /> element. Buttons are not handled by the browser in the same way as other elements. Most importantly, it seems that right-clicking on a button does nothing. There is no context menu and, as far as I can tell, no event.
Am I really wrong? I hope so because it makes my life easier. If not, I can simulate a button with a div and some CSS, but I would prefer to avoid this. Any thoughts?
(PS: This is for stupid third-party projects, so don't worry about trying to put the right-click interface in front of any clients or anything else. I know very well how awful the interface will probably be.)
source share