Closed
Description
Capybara Version: 3.6.0
Driver Version: ChromeDriver 2.41.578706
Chrome Version: 69.0.3497.81
I have various drag and drop tests that work fine in version 3.5.1. They simply stop working when Capybara is upgraded to versions 3.6.0, 3.7.0, or 3.7.1.
What has changed? I can't seem to find much information about it.
Activity
twalpole commentedon Sep 11, 2018
Prior to 3.6.0 all that was generated for drag/drop was mousedown, mousemove, mouseup, in 3.6.0+ Capybara generates HTML5 native drag and drop events for Chrome - 0538cb6 if the element has the HTML5
draggable
attribute set to "true". It passes the tests in the Capybara suite for HTML5 drag and drop but it's possible it's missing something - what does your drag and drop use/require and what does the element you're dragging look like?pbougie commentedon Sep 11, 2018
I'm dragging
<a>
elements into<td>
elements using the Dragula JS library. I am not using the HTML5draggable
attribute.Also just tried Firefox Nightly with the same results.
twalpole commentedon Sep 11, 2018
If the
<a>
elements don't have adraggable
attribute then the behavior should be the same as it was in 3.6.0. In 3.7.0+ there was a change because webdriver compliant drivers no longer automatically scroll elements into view when using the actions API, so I had to implement the scrolling manually. Is the project/page you're testing publicly accessible or can you provide a reproducible example?twalpole commentedon Sep 11, 2018
Below is a small ruby snippet that shows drag/drop working on the dragula example site, so if we can figure out what the difference between your usage and the dragula example is it would help narrow this down
pbougie commentedon Sep 11, 2018
Unfortunately, it's not publicly accessible. I'll try to put something together to reproduce the problem. Thanks.
twalpole commentedon Sep 11, 2018
After thinking about this for a while - I know why it's happening. Images and links (the elements you're dragging) default to having the HTML5
draggable="true"
. A workaround would be to add adraggable="false"
attribute to all the elements you're dragging using dragula (or wrap them in an elements that's not an ) until we can fix this. I guess I need to figure out how to tell whether another library is handling dragging -- hmmmm.twalpole commentedon Sep 11, 2018
The
draggable="false"
workaround won't work due to a bug in Selenium treatingdraggable
as a boolean attribute rather than the enumerated attribute that it is - SeleniumHQ/selenium#6396pbougie commentedon Sep 11, 2018
I was just trying it before you sent this and it wasn't working.
twalpole commentedon Sep 11, 2018
@pbougie Please try the
drag_link
branch and see if that works correctly for you. It should revert to the old dragging behavior if the initial mousedown event is defaultPrevented whichdragula
should be doing to disable default HTML5 drag and drop. Should only work on Chrome currently -- I'll fix FF too if it works.pbougie commentedon Sep 11, 2018
Branch
drag_link
is working. Thanks.twalpole commentedon Sep 12, 2018
drag_link
branch should be fixed for FF as well now -- Assuming tests pass I'll merge it intomaster
and3.7_stable
branches and then do a 3.7.2 release tomorrow or Thursday.twalpole commentedon Sep 12, 2018
Closing via 195930d
5 remaining items