Ticket #5197 (open bug)
Sortable: using a large or complex placeholder in IE8 causes drag to stop prematurely
| Reported by: | gimparm | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 2.0.0 |
| Component: | ui.sortable | Version: | 1.7.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
From
http://forum.jquery.com/topic/ie8-sortable-placeholder
see minimal test case:
Steps to reproduce:
- In IE8
- Start dragging a sortable element
- Note the large placeholder appear
- Drag quickly in all sorts of directions
Expected: The sortable placeholder moves around as it's dragged
Actual: At some point (it doesn't take much) the sorting/dragging stops, even though the left mouse button is still held down.
Change History
comment:2 in reply to: ↑ 1 Changed 3 years ago by adrian.elder
Replying to oov:
I know. This problem is caused by the following code.
//in jquery.ui.mouse.js if ($.browser.msie && !event.button) { return this._mouseUp(event); }This process should only be applied to IE6-7.
If jquery.ui.mouse.js is updated to use Microsoft's mouse capture, this workaround for dragging off screen becomes unnecessary and the issue of mousemove firing erroneously with event.button===0 goes away with it. As an added plus, the mouse capture approach is amenable to feature detection rather than browser checking.
Mouse capture is described here: http://msdn.microsoft.com/en-us/library/ms537630(VS.85).aspx
Working example of fix: http://jsbin.com/umuza3/47
Added to _mouseDown
$(this.element).each(function(){
if (this.setCapture ){
this.setCapture();
}
});
Added to _mouseUp
if (document.releaseCapture){
document.releaseCapture();
}
Removed old browser detection workaround from _mouseMove
comment:3 Changed 3 years ago by adrian.elder
Since setCapture really should only be called on one element, I think the following approach would be preferred:
Added to _mouseDown
if ( this.element[0] && this.element[0].setCapture ){
this.element[0].setCapture();
}
comment:5 Changed 3 years ago by oov
It is not fixed.
bad: http://jsbin.com/umuza3/53
if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
good1: http://jsbin.com/umuza3/54
if ($.browser.msie && !(document.documentMode >= 8) && !event.button) {
good2: http://jsbin.com/umuza3/55
if ($.browser.msie && !$.support.boxModel && !event.button) {
comment:7 Changed 2 years ago by david.f.todd
There are two problems that a solution for this has to address:
- Selecting an element and then dragging and dropping it offscreen has to actually drop it.
- Quickly dragging a complex element shouldn't cause it to randomly drop.
Changing the browser check to check for boxModel or documentMode < 8 doesn't work, it just switches which of those problems you see.
The setCapture approach does appear to work, but it's important to note that the _mouseDown portion needs to occur *after* the _mouseCapture() check, because if that returns false, then _mouseUp and releaseCapture aren't going to be fired.
comment:9 Changed 7 months ago by mikesherov
- Status changed from new to open
confirmed on latest: http://jsfiddle.net/hSjMf/
comment:10 Changed 3 months ago by tj.vantoll
Worth noting that this bug does not occur in IE7, 9, or 10. Just IE8.


I know. This problem is caused by the following code.
//in jquery.ui.mouse.js if ($.browser.msie && !event.button) { return this._mouseUp(event); }This process should only be applied to IE6-7.