Open Bug 697059 Opened 12 years ago Updated 6 months ago

preventDefault on right-click can cancel context menu (despite pref)


(Firefox :: Menus, defect)

7 Branch
Windows XP





(Reporter: dustbin, Unassigned)


(Keywords: ux-control, Whiteboard: [bugday-20131106])


(1 file)

In the options I forbit JS to deactivate or exchange the context-menu.
But this simple jQuery-Code hides my browser-context-menu. 

Should we just not allow content to .preventDefault for click events?
Also, I don't think this needs to remain security-private: there is no exploit, just malfunctioning of a user-control preference.
Group: core-security
Sites commonly rely on preventDefault for click events to work, at least for left-click, for basic functionality (like progressive enhancement from links to XHR-based replacement).

For right-click sites use it to try to put in their own context menu, mostly.  We can break that and see how much screaming we get, I guess.
Yeah, I just mean for right-click. Or when site context menus are disabled, just ignore the defaultPrevented status of the (right) click event?
And Ctrl+click on Mac, presumably.
Keywords: ux-control
Summary: Prevent JS from deactivating context menu → preventDefault on right-click can cancel context menu (despite pref)
I think comment 4 should be fine, yeah....
Still present in 15.x (how is this still unconfirmed?):
<script type="text/javascript">
message="Sorry, I've hijacked your browser's UI because I'm awake all night worried people will steal my images =[";
function ffdisable(e) {
  if (e.button==2) { e.preventDefault(); e.stopPropagation(); alert(message); }

With and 2013-11-06-03-02-00-mozilla-central-firefox-28.0a1.en-US.linux-x86_64,
the context menu appears no matter what value dom.event.contextmenu.enabled has.  However, the menu doesn't work until clicked (is it unfocused?).
Whiteboard: [bugday-20131106]
Note: the menu appears under/behind the alert box.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.