Tree context menu and browser context menu

I have added an item context menu to my tree with addActionHandler. Now when I right click the item, the popup menu is opened but also the browser context menu opens and hides the Vaadin popup. I can left click anywhere on the page to hide the browser context menu and see the tree item popup but I doubt my users will accept this solution. Is there anything I can do to work around this problem?

BTW, the same happens for the tree popup menu on the sampler page. I am using the latest Firefox on Mac OS X if this matters.

Michael

I tested the “Tree, context menu” sample from demo.vaadin.com (6.3.0) with Firefox 3.6.3 (OSX), and could not reproduce this error.

Can anyone else try this?

Here is a screenshot of what I get with Firefox 3.6.3 on Mac OS X when I right-click an item in the tree context menu sampler. If you look closely you can see the Vaadin context menu below the Firefox context menu.
11270.png

I have similar problem but slightly different scenario. Here is what I have. I have a tree and one of the column’s content is CssLayout ( to add a String and a button). Normally (if this column content is just a string) my context-menu works just fine, but when I have CssLayout as column content and when I place mouse on THIS column and do a right click, instead of my context-menu appearing, browser right-click menu is appearing. On any other column right click does produce my context-menu.

Please suggest any solutions for this issue.

Thanks
Raj.

I have similar problem but slightly different scenario. Here is what I have. I have a tree and one of the column’s content is CssLayout ( to add a String and a button). Normally (if this column content is just a string) my context-menu works just fine, but when I have CssLayout as column content and when I place mouse on THIS column and do a right click, instead of my context-menu appearing, browser right-click menu is appearing. On any other column right click does produce my context-menu.

Please suggest any solutions for this issue.

Here is the example code that demonstrate the issue.

package com.example.helloworld;
import com.vaadin.Application;
import com.vaadin.event.Action;
import com.vaadin.ui.Button;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

public class HelloworldApplication extends Application {
static final Action ACTION_MARK = new Action(“Mark”);
static final Action ACTION_UNMARK = new Action(“Unmark”);
static final Action ACTION_LOG = new Action(“Save”);
static final Action ACTIONS_UNMARKED = new Action
{ ACTION_MARK,
ACTION_LOG };
static final Action ACTIONS_MARKED = new Action
{ ACTION_UNMARK,
ACTION_LOG };

@Override
public void init() {
	Window mainWindow = null;	
	mainWindow = new Window("My Window");

	Panel mainPanel = new Panel();
	mainPanel.setWidth("100%");
	mainPanel.setHeight("100%");
	mainPanel.setStyleName(Panel.STYLE_LIGHT);
	mainWindow.setContent(mainPanel);
	setMainWindow(mainWindow);
	setTheme("myTheme");

	
	/* Create the table with a caption. */
	Table table = new Table("This is my Table");
	/* Define the names and data types of columns.
	* The "default value" parameter is meaningless here. */
	table.addContainerProperty("First Name", String.class, null);
	table.addContainerProperty("Last Name", String.class, null);
	table.addContainerProperty("Year", Integer.class, null);
	table.addContainerProperty("Description", CssLayout.class, null);
	
	CssLayout description1 = new CssLayout();
	description1.addComponent(new Label("Some one"));
	description1.addComponent(new Button("Very Special"));
	
	CssLayout description2 = new CssLayout();
	description2.addComponent(new Label("Some one"));
	description2.addComponent(new Button("Very Special"));
	
	CssLayout description3 = new CssLayout();
	description3.addComponent(new Label("Some one"));
	description3.addComponent(new Button("Very Special"));
	
	CssLayout description4 = new CssLayout();
	description4.addComponent(new Label("Some one"));
	description4.addComponent(new Button("Very Special"));
	
	CssLayout description5 = new CssLayout();
	description5.addComponent(new Label("Some one"));
	description5.addComponent(new Button("Very Special"));
	
	CssLayout description6 = new CssLayout();
	description6.addComponent(new Label("Some one"));
	description6.addComponent(new Button("Very Special"));

	/* Add a few items in the table. */
	table.addItem(new Object[] {
	"Nicolaus","Copernicus",new Integer(1473), description1}, new Integer(1));
	table.addItem(new Object[] {
	"Tycho", "Brahe", new Integer(1546), description2},  new Integer(2));
	table.addItem(new Object[] {
	"Giordano","Bruno", new Integer(1548), description3}, new Integer(3));
	table.addItem(new Object[] {
	"Galileo", "Galilei", new Integer(1564), description4}, new Integer(4));
	table.addItem(new Object[] {
	"Johannes","Kepler", new Integer(1571), description5}, new Integer(5));
	table.addItem(new Object[] {
	"Isaac", "Newton", new Integer(1643), description6}, new Integer(6));

	
	// Actions (a.k.a context menu)
    table.addActionHandler(new Action.Handler() {
        public Action[] getActions(Object target, Object sender) {
                return ACTIONS_MARKED;
            }

        public void handleAction(Action action, Object sender, Object target) {
            if (ACTION_MARK.equals(action)) {
            } else if (ACTION_UNMARK.equals(action)) {
            } else if (ACTION_LOG.equals(action)) {
            }

        }

    });
	
	
	VerticalLayout panelContent = (VerticalLayout)mainPanel.getContent();
	panelContent.setWidth("100%");
	//panelContent.setHeight("100%");

	VerticalLayout allCompPane = new VerticalLayout();
	panelContent.addComponent(allCompPane);

	allCompPane.addComponent(table);

}

Thanks
Raj.

Couldn’t reproduce with Firefox 3.6.3 on OS X. Could this be an issue with some Firefox add-on?

I have tested my code with IE7, FireFox 3.6.3 and Chrome 5.0.375. All of them have same behavior.