summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorAdam Wagner <wbadam@users.noreply.github.com>2017-05-02 23:35:33 +0300
committerPekka Hyvönen <pekka@vaadin.com>2017-05-02 23:35:33 +0300
commit61bada07475d77b88c112b19519ef88c58d5fe87 (patch)
tree404ebc148ecca96bf9d3d0ce59ab1d64b14eb592 /client/src
parenta1c2b2f6764e51acdab16a8cd3234fba1d688005 (diff)
downloadvaadin-framework-61bada07475d77b88c112b19519ef88c58d5fe87.tar.gz
vaadin-framework-61bada07475d77b88c112b19519ef88c58d5fe87.zip
Disable drag and drop for touch devices (#9216)
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/grid/GridDragSourceConnector.java6
-rw-r--r--client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java6
-rw-r--r--client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java6
3 files changed, 18 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridDragSourceConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridDragSourceConnector.java
index 2caa82e84e..3f673bac01 100644
--- a/client/src/main/java/com/vaadin/client/connectors/grid/GridDragSourceConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridDragSourceConnector.java
@@ -27,6 +27,7 @@ import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.TableRowElement;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
+import com.vaadin.client.BrowserInfo;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.extensions.DragSourceExtensionConnector;
@@ -71,6 +72,11 @@ public class GridDragSourceConnector extends DragSourceExtensionConnector {
protected void extend(ServerConnector target) {
gridConnector = (GridConnector) target;
+ // Do not make elements draggable on touch devices
+ if (BrowserInfo.get().isTouchDevice()) {
+ return;
+ }
+
// Set newly added rows draggable
getGridBody().setNewEscalatorRowCallback(
rows -> rows.forEach(this::setDraggable));
diff --git a/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java b/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java
index 946f37a9b1..8a26694bde 100644
--- a/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java
+++ b/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java
@@ -20,6 +20,7 @@ import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.BrowserInfo;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.annotations.OnStateChange;
@@ -58,6 +59,11 @@ public class DragSourceExtensionConnector extends AbstractExtensionConnector {
protected void extend(ServerConnector target) {
dragSourceWidget = ((ComponentConnector) target).getWidget();
+ // Do not make elements draggable on touch devices
+ if (BrowserInfo.get().isTouchDevice()) {
+ return;
+ }
+
setDraggable(getDraggableElement());
addDragListeners(getDraggableElement());
}
diff --git a/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java b/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java
index 9686ea796e..e3fbeabab4 100644
--- a/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java
+++ b/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java
@@ -19,6 +19,7 @@ import com.google.gwt.dom.client.DataTransfer;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.BrowserInfo;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ServerConnector;
import com.vaadin.event.dnd.DropTargetExtension;
@@ -78,6 +79,11 @@ public class DropTargetExtensionConnector extends AbstractExtensionConnector {
protected void extend(ServerConnector target) {
dropTargetWidget = ((ComponentConnector) target).getWidget();
+ // Do not make elements drop target on touch devices
+ if (BrowserInfo.get().isTouchDevice()) {
+ return;
+ }
+
addDropListeners(getDropTargetElement());
}