I just noticed that a modal PopupPanel blocks click and mousedown events, but it allows the user to trigger contextmenu events against other windows:
https://screencast.com/t/bRM09iCeF This might be working as designed, depending on how you interpret the documentation: http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/PopupPanel.html#setModal-boolean- *When the popup is modal, keyboard or mouse events that do not target the PopupPanel or its children will be ignored.* When I subclass onPreviewNativeEvent <http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/PopupPanel.html#onPreviewNativeEvent-com.google.gwt.user.client.Event.NativePreviewEvent-> and log the events that it sees, the contextmenu event isn't being reported; maybe it's not considered to be a mouse event? Is there any way for me to optionally include contextmenu in the set of events that get filtered through onPreviewNativeEvent? The sample is a hacked version of the standard GWT Sample project: package com.basis.sample.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ContextMenuEvent; import com.google.gwt.event.dom.client.ContextMenuHandler; import com.google.gwt.event.dom.client.MouseDownEvent; import com.google.gwt.event.dom.client.MouseDownHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.RootPanel; public class Sample implements EntryPoint { @Override public void onModuleLoad() { final Button popupButton = new Button("Popup"); final Button sampleButton = new Button("Button"); RootPanel.get("nameFieldContainer").add(popupButton); RootPanel.get("sendButtonContainer").add(sampleButton); class MyHandler implements ClickHandler, MouseDownHandler, ContextMenuHandler { @Override public void onClick(ClickEvent event) { Window.alert("onClick " + event); } @Override public void onContextMenu(ContextMenuEvent event) { event.preventDefault(); Window.alert("onContextMenu " + event); } @Override public void onMouseDown(MouseDownEvent event) { if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) Window.alert("onMouseDown (right) " + event); } } DialogBox popup = new DialogBox(false, true); popup.setText("Modal Dialog"); Button closePopup = new Button("Close"); closePopup.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { popup.hide(); } }); popup.add(closePopup); popupButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { popup.center(); } }); MyHandler handler = new MyHandler(); popupButton.addDomHandler(handler, ContextMenuEvent.getType()); sampleButton.addClickHandler(handler); sampleButton.addMouseDownHandler(handler); sampleButton.addDomHandler(handler, ContextMenuEvent.getType()); } } -- You received this message because you are subscribed to the Google Groups "GWT Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.