Re:Try right clicking GitHub's logo
by famousactress on Thursday April 12, 2012 @01:46PM
(#3833433)
I find it kind of disarming to overload not-typically-overloaded events like this though. I wonder if it'd be possible to let the right-click menu appear as normal, but background a div that pops up and give you the option of downloading the nicer logo files?
[ Parent
| on HN ]
In Firefox you can untick "Allow scripts to Disable or replace context menus" (hidden under Preferences/Content/Enable Javasript/Advanced), which gives exactly the behaviour that you described. I assume other browsers have similar options.
It's not exactly what you suggested, but with HTML5 you can add to the browser's context menu:
http://hacks.mozilla.org/2011/11/html5-context-menus-in-fire... http://www.whatwg.org/specs/web-apps/current-work/multipage/...
That should be possible if you do not cancel the event bubble when the overlay is shown. I did not have time to inspect their code, but I assume they are canceling the event.
You're thinking of preventing the default action, not stopping propagation. (Event.preventDefault() vs. Event.stopPropagation() in modern browsers.) But you're right, if they handled the right-click and did not explicitly prevent the default action it would do both.