svenmeier / wicket-dnd

Wicket drag-and-drop
20 stars 14 forks source link

Prevent drag-start in IE when scrolling on an element with a scrollbar #19

Open d2a-raudenaerde opened 6 years ago

d2a-raudenaerde commented 6 years ago

Hi,

Currently, in IE11, if you mousedown on a scollbar to scroll a DIV with overflow:scroll, this registers as a start-of-drag and drop.

It can be prevented by returning early in the dragsource:

                $(element).on('mousedown', selectors.initiate, function(event) {
                    if ($(event.target).is('input,select,option,button,textarea')) {
                        return;
                    }
                    if (inScrollRange(event)) {
                        console.log("No drag and drop, we are on a scrollbar!");
                        return;
                    }

The imlementation of inScrollRange can be taken from: http://jsfiddle.net/aKejW/

I got this to work, but it is still a bit messy. Maybe you have a better idea?