diff options
-rw-r--r-- | client/src/com/vaadin/client/connectors/GridConnector.java | 16 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/contextclick/GridContextClickTest.java | 17 |
2 files changed, 33 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/connectors/GridConnector.java b/client/src/com/vaadin/client/connectors/GridConnector.java index 0b485a8e5a..1097a2f277 100644 --- a/client/src/com/vaadin/client/connectors/GridConnector.java +++ b/client/src/com/vaadin/client/connectors/GridConnector.java @@ -1186,6 +1186,12 @@ public class GridConnector extends AbstractHasComponentsConnector implements @Override protected void sendContextClickEvent(MouseEventDetails details, EventTarget eventTarget) { + // if element is the resize indicator, ignore the event + if (isResizeHandle(eventTarget)) { + WidgetUtil.clearTextSelection(); + return; + } + EventCellReference<JsonObject> eventCell = getWidget().getEventCell(); Section section = eventCell.getSection(); @@ -1202,6 +1208,16 @@ public class GridConnector extends AbstractHasComponentsConnector implements WidgetUtil.clearTextSelection(); } + private boolean isResizeHandle(EventTarget eventTarget) { + if (Element.is(eventTarget)) { + Element e = Element.as(eventTarget); + if (e.getClassName().contains("-column-resize-handle")) { + return true; + } + } + return false; + } + /** * Creates a concatenation of all columns errors for Editor. * diff --git a/uitest/src/com/vaadin/tests/contextclick/GridContextClickTest.java b/uitest/src/com/vaadin/tests/contextclick/GridContextClickTest.java index 7b97de2be5..6ee7a89178 100644 --- a/uitest/src/com/vaadin/tests/contextclick/GridContextClickTest.java +++ b/uitest/src/com/vaadin/tests/contextclick/GridContextClickTest.java @@ -18,6 +18,7 @@ package com.vaadin.tests.contextclick; import static org.junit.Assert.assertEquals; import org.junit.Test; +import org.openqa.selenium.WebElement; import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.GridElement; @@ -89,4 +90,20 @@ public class GridContextClickTest extends AbstractContextClickTest { } + /** + * Performs a context click on given element at coordinates 20, 10 followed + * by a regular click. This prevents browser context menu from blocking + * future operations. + * + * A smaller X offset might hit the resize handle of the previous cell that + * overlaps with the next header cell. + * + * @param e + * web element + */ + @Override + protected void contextClick(WebElement e) { + contextClick(e, 20, 10); + } + } |