Side navigation
#4197 closed bug (duplicate)
Opened February 20, 2009 05:34AM UTC
Closed April 30, 2009 09:10PM UTC
Last modified March 14, 2012 03:11PM UTC
live events' "click" handler catches right clicks (unlike normal click event)
| Reported by: | jicksta | Owned by: | brandon |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3.2 |
| Component: | event | Version: | 1.3.1 |
| Keywords: | live, click, event | Cc: | |
| Blocked by: | Blocking: |
Description
You can test it out yourself:
http://docs.jquery.com/Events/live
If you right click the example "Click me!" element, it'll trigger the "click" event. Now, right click one of example elements on this page:
http://docs.jquery.com/Events/click
Only the live click event reacts to the right click. I first noticed this when using Firebug to inspect an element that had a live event defined on it. Not being able to easily inspect an element anymore is quite painful. :)
Major kudos on jQuery, though! It makes Javascript fun again. :)
Attachments (0)
Change History (5)
Changed February 26, 2009 06:58PM UTC by comment:1
Changed March 25, 2009 07:38PM UTC by comment:2
I see this also on Firefox in Mac OS. I'm seeing it for regular a tags though, not just document.
Changed April 01, 2009 06:12AM UTC by comment:3
Same problem here!
I've created an test case before finding this bug. The case is here:
http://jquery.nodnod.net/cases/284
I didn't had the time to look into it yet on jQuery source code, but I'm using an nasty workaround for now. Really nasty!
// Fix for .live() bug with right click on Firefox,
// because right click it's not a click!
jQuery.fn.__live__ = jQuery.fn.live;
jQuery.fn.live = function(type,fn) {
if(type != 'click') {
return this.__live__(type, fn);
} else {
var anti_right_click_callback = fn;
var anti_right_click_proxy = function(e) {
if(e && e.button && e.button === 2) {
e.preventDefault();
e.stopPropagation();
return false;
} else {
anti_right_click_callback.call(this, e);
}
};
return this.__live__(type, anti_right_click_proxy);
}
};
This is of course the incorrect approach to jQuery, but someone desperate for a solution my have some usefullness to it.
I came across this issue as well in my current project. I noticed that it only occurs when binding to
documentand only in Firefox (confirmed on Mac OS, not sure about Windows)