From 7220ca8758e44ae84ae5c9ef0623dc9585f6d171 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Tue, 20 Aug 2013 13:30:47 +0300 Subject: [PATCH] Fixed DragAndDropWrapper using wrong drop target in IE8 #12406 VDragAndDropManager was assuming that the target element will always be inside the cloned "drag image" element while dragging. This assumption is false since the "drag image" can be 0x0px or transparent effectivly disabling dragging. Since Testbench 2 is also very flaky in using the Vaadin locators with the drag/drop commands I replaced the locators with shorter locators using a debug id to make the test more readable and stable. Change-Id: I2cc9683d11e982521e74418c74dd3e81ee617ac5 --- .../client/ui/dd/VDragAndDropManager.java | 4 +--- .../draganddropwrapper/DragAndDropDisable.html | 17 ++++++++--------- .../draganddropwrapper/DragAndDropDisable.java | 4 ++++ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java index dd838fdeff..b4cf008a38 100644 --- a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -93,9 +93,7 @@ public class VDragAndDropManager { targetElement = targetNode.getParentElement(); } - if (Util.isTouchEvent(nativeEvent) - || (dragElement != null && dragElement - .isOrHasChild(targetElement))) { + if (Util.isTouchEvent(nativeEvent) || dragElement != null) { // to detect the "real" target, hide dragelement temporary and // use elementFromPoint String display = dragElement.getStyle().getDisplay(); diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html index 1565e5eb96..50b66a3b68 100644 --- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.html @@ -3,7 +3,6 @@ - DragAndDropDisable @@ -18,12 +17,12 @@ drag - vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0] + vaadin=runDragAndDropDisable::PID_Scsslayout-2 18,25 drop - vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0] + vaadin=runDragAndDropDisable::PID_Scsslayout-1 34,51 @@ -33,27 +32,27 @@ drag - vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0] + vaadin=runDragAndDropDisable::PID_Scsslayout-2 20,32 drop - vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0] + vaadin=runDragAndDropDisable::PID_Scsslayout-1 37,59 drag - vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]/VLabel[0] + vaadin=runDragAndDropDisable::PID_Scsslayout-1/VLabel[0] 59,10 drop - vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0] + vaadin=runDragAndDropDisable::PID_Scsslayout-2 68,15 mouseClick - vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0]/VLabel[0] + vaadin=runDragAndDropDisable::PID_Scsslayout-1/VLabel[0] 68,160 @@ -63,7 +62,7 @@ drop - vaadin=runDragAndDropDisable::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VPanel[0]/VDragAndDropWrapper[0]/VCssLayout[0] + vaadin=runDragAndDropDisable::PID_Scsslayout-1 118,50 diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java index fb7ed92967..02dc326ed8 100644 --- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java +++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java @@ -31,9 +31,11 @@ public class DragAndDropDisable extends AbstractTestUI { addComponent(p); final CssLayout layout = new CssLayout(); + layout.setId("csslayout-1"); layout.setHeight("100px"); final DragAndDropWrapper dnd = new DragAndDropWrapper(layout); + dnd.setId("ddwrapper-1"); p.setContent(dnd); final CheckBox enabled = new CheckBox("Enabled", true); @@ -68,9 +70,11 @@ public class DragAndDropDisable extends AbstractTestUI { addComponent(p); final CssLayout layout = new CssLayout(); + layout.setId("csslayout-2"); layout.setHeight("100px"); final DragAndDropWrapper dnd = new DragAndDropWrapper(layout); + dnd.setId("ddwrapper-2"); p.setContent(dnd); final CheckBox enabled = new CheckBox("Enabled", true); -- 2.39.5