[openstreetmap/openstreetmap-website] Dragging routing icons does not work in IE/Edge (#1343)

Petr Kadlec notifications at github.com
Thu Oct 27 10:33:01 UTC 2016

In Internet Explorer 11, the routing icons cannot be dragged, it does not work at all. In Edge, the dragging seems to work, but the “to” icon is dropped always, even though the “from” icon was dragged.

Both issues come from a wrong implementation of the drag&drop code in OSM (plus worse compatibility of IE, obviously): The first argument to `DataTransfer.setData` is not some data subkey (like `$().data()` works), it is `format` (see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setData) and [WhatWG](https://html.spec.whatwg.org/multipage/interaction.html#dom-datatransfer-setdata)) And IE explicitly supports only two formats: `text` and `URL` (see [MSDN](https://msdn.microsoft.com/en-us/library/ms536744.aspx)), so we need to use one of them (probably `text`) and do our own subkeying under that, if needed. (It might make sense to separate drag&drop handling to some library to cover this compatibility stuff, should drag&drop get used more in OSM.)

Also, IE does not support `.setDragImage` (see [CanIUse](http://caniuse.com/#feat=dragndrop)), so we need to conditionalize that.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20161027/fc0ec2df/attachment.html>

More information about the rails-dev mailing list