Monthly Archives: February 2009

Show right-click menus on form elements

Ever since bug 404536 has landed, a number of users have been angry.  What that bug did was removing the context menu for HTML form elements.  This change annoyed mainly two classes of users: those who were accustomed to those context menus, and those who used extensions which add menu items to the context menus for form elements (along with other elements, possibly), most notably, Firebug.

Exactly one year later, I am releasing the Form Control Context Menu extension, with the sole purpose of reverting back to the old behavior of showing the context menus for HTML form elements.  So, if you’ve been affected by this in the past, jump up and install this extension.  It can be installed on anything from Firefox 3.0 Beta 4 to the latest trunk builds.

Remember that the extension is currently in sandbox, so you need to log in before installing it.  Make sure to leave your comments if you find the extension useful, because moving it out of the sandbox needs your comment love. 

If you are an extension developer, and your extension adds something to those context menus, and is hence affected by that fix, you can either ask your users to install the Form Control Context Menu extension, or use the below code inside your own extension.  This code needs to run exactly once for each browser window, so you can add it to the load event handler of the XUL window.

let setTargetOriginal = nsContextMenu.prototype.setTarget;
nsContextMenu.prototype.setTarget = function(aNode, aRangeParent, aRangeOffset) {
  setTargetOriginal.apply(this, arguments);
  if (this.isTargetAFormControl(aNode))
    this.shouldDisplay = true;
};

For the curious, this is exactly the same code used inside the extension.  You can browse the extension’s source code on AMO, but there’s nothing too interesting there.

Posted in Blog Tagged with: , ,

Form Control Context Menu

Form Control Context Menu

Form Control Context Menu is an extension for Firefox, which simply enables the browser context menu for HTML form control elemnts, such as buttons, drop-down boxes, check boxes, radio buttons, and image buttons.

Find In Numbers Preview

Rationale

About one year ago, I fixed Firefox bug 404536 which caused the browser context menu not appear when the mouse right button is pressed on a form control in web pages, which means either buttons, drop-down boxes, check boxes, radio buttons, or image buttons.  The rationale behind that bug was an attempt to better match the native OS behavior for those controls (for example, buttons in Windows usually do not have any context menus).  This change was released with Firefox 3.0.

This however, made quite a few users angry, because they were either used to this menu and found it useful, or they used extensions which added menu items to these menus, and suddenly there was no way to get to those menu items.

This extension simply reverts to the old behavior of showing the context menu on all HTML elements, including the form elements.

How to Get It?

Installing Form Control Context Menu is as simple as installing any other extension for Firefox.  Simply, view the Form Control Context Menu extension’s page on AMO, and grab the latest version from there.  The latest version currently is 1.0.

How It Works

This extension does not have any user interface, and once you install it, it just works (the context menus start to appear again).

Known Problems

None so far.

Posted in Extension